Submission #1561148
Source Code Expand
import java.util.*; import java.io.*; public class Main { class Point { long x, y; public Point(long x, long y) { super(); this.x = x; this.y = y; } } long vm(Point a, Point b, Point c) { return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); } void solve() { int mod = 998244353; int n = in.nextInt(); Point[] a= new Point[n]; for (int i = 0; i < n; i++) { a[i] = new Point(in.nextLong(), in.nextLong()); } long[] pow2 = new long[n + 1]; pow2[0] = 1; for (int i = 0; i < n; i++) { pow2[i + 1] = pow2[i] * 2 % mod; } long result = pow2[n] - 1; for (int i = 0; i < n; i++) { result--; for (int j = i + 1; j < n; j++) { int cnt = 0; for (int k = j + 1; k < n; k++) { if (vm(a[i], a[j], a[k]) == 0) { cnt++; } } result -= pow2[cnt]; } } out.println((result % mod + mod) % mod); } FastScanner in; PrintWriter out; void run() { in = new FastScanner(); out = new PrintWriter(System.out); solve(); out.close(); } class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } public FastScanner(String s) { try { br = new BufferedReader(new FileReader(s)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String nextToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(nextToken()); } public long nextLong() { return Long.parseLong(nextToken()); } public double nextDouble() { return Double.parseDouble(nextToken()); } } public static void main(String[] args) { new Main().run(); } }
Submission Info
Submission Time | |
---|---|
Task | E - ConvexScore |
User | VArtem |
Language | Java8 (OpenJDK 1.8.0) |
Score | 700 |
Code Size | 1997 Byte |
Status | AC |
Exec Time | 104 ms |
Memory | 23636 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 85 ms | 20948 KB |
0_001.txt | AC | 74 ms | 20692 KB |
0_002.txt | AC | 74 ms | 21204 KB |
1_003.txt | AC | 77 ms | 20820 KB |
1_004.txt | AC | 85 ms | 21332 KB |
1_005.txt | AC | 97 ms | 18260 KB |
1_006.txt | AC | 83 ms | 21332 KB |
1_007.txt | AC | 90 ms | 17876 KB |
1_008.txt | AC | 99 ms | 19924 KB |
1_009.txt | AC | 93 ms | 21204 KB |
1_010.txt | AC | 92 ms | 23636 KB |
1_011.txt | AC | 92 ms | 21716 KB |
1_012.txt | AC | 91 ms | 21076 KB |
1_013.txt | AC | 99 ms | 21588 KB |
1_014.txt | AC | 77 ms | 23380 KB |
1_015.txt | AC | 104 ms | 20052 KB |
1_016.txt | AC | 101 ms | 21588 KB |
1_017.txt | AC | 100 ms | 20820 KB |
1_018.txt | AC | 99 ms | 20180 KB |
1_019.txt | AC | 94 ms | 21716 KB |
1_020.txt | AC | 96 ms | 20308 KB |
1_021.txt | AC | 94 ms | 21076 KB |
1_022.txt | AC | 95 ms | 19924 KB |
1_023.txt | AC | 95 ms | 19796 KB |
1_024.txt | AC | 96 ms | 23508 KB |
1_025.txt | AC | 97 ms | 21204 KB |
1_026.txt | AC | 96 ms | 21716 KB |
1_027.txt | AC | 104 ms | 20308 KB |
1_028.txt | AC | 104 ms | 21972 KB |
1_029.txt | AC | 98 ms | 21460 KB |
1_030.txt | AC | 96 ms | 18644 KB |
1_031.txt | AC | 97 ms | 20820 KB |
1_032.txt | AC | 97 ms | 21588 KB |
1_033.txt | AC | 94 ms | 21588 KB |
1_034.txt | AC | 96 ms | 16340 KB |
1_035.txt | AC | 95 ms | 21716 KB |