Submission #121200

#TimeUsernameProblemLanguageResultExecution timeMemory
121200_7_7_Triangles (CEOI18_tri)C++14
Compilation error
0 ms0 KiB
//#include <bits/stdc++.h> #include "trilib.h" using namespace std; const int N = 1e5 + 11; int n; long long *x, *y; int queries=0; bool was[N]; static void init() { static int is_inited=0; if (is_inited) return; is_inited=1; assert(scanf("%d", &n)==1); x=(long long*)malloc((n+1)*sizeof(long long)); y=(long long*)malloc((n+1)*sizeof(long long)); for (int i=1; i<=n; i++) assert(scanf("%lld%lld", &x[i], &y[i])==2); } int get_n() { init(); return n; } int is_clockwise(int a, int b, int c) { init(); assert(a>=1 && a<=n); assert(b>=1 && b<=n); assert(c>=1 && c<=n); assert(a!=b && a!=c && b!=c); queries++; if(queries == 1000 * 1000 + 1) printf("Too many queries!"); return (x[b]-x[a])*(y[c]-y[a])-(x[c]-x[a])*(y[b]-y[a])<0; } void give_answer(int s) { init(); s = 0; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) { if (i == j) continue; bool ok = 1; for (int x = 1; x <= n; ++x) { if (i == x || j == x) continue; if (!is_clockwise(i, j, x)) { ok = 0; break; } } if (ok) { if (!was[i]) { ++s; was[i] = 1; } if (!was[j]) { was[j] = 1; ++s; } } } printf("%d\n", s); }

Compilation message (stderr)

tri.cpp: In function 'void init()':
tri.cpp:18:9: error: 'scanf' was not declared in this scope
  assert(scanf("%d", &n)==1);
         ^~~~~
tri.cpp:18:2: error: 'assert' was not declared in this scope
  assert(scanf("%d", &n)==1);
  ^~~~~~
tri.cpp:18:2: note: suggested alternative: 'short'
  assert(scanf("%d", &n)==1);
  ^~~~~~
  short
tri.cpp:19:16: error: 'malloc' was not declared in this scope
  x=(long long*)malloc((n+1)*sizeof(long long));
                ^~~~~~
tri.cpp: In function 'int is_clockwise(int, int, int)':
tri.cpp:32:2: error: 'assert' was not declared in this scope
  assert(a>=1 && a<=n);
  ^~~~~~
tri.cpp:32:2: note: suggested alternative: 'short'
  assert(a>=1 && a<=n);
  ^~~~~~
  short
tri.cpp:38:13: error: 'printf' was not declared in this scope
             printf("Too many queries!");
             ^~~~~~
tri.cpp:38:13: note: suggested alternative: 'int'
             printf("Too many queries!");
             ^~~~~~
             int
tri.cpp: In function 'void give_answer(int)':
tri.cpp:69:2: error: 'printf' was not declared in this scope
  printf("%d\n", s);
  ^~~~~~
tri.cpp:69:2: note: suggested alternative: 'int'
  printf("%d\n", s);
  ^~~~~~
  int