Submission #424886

#TimeUsernameProblemLanguageResultExecution timeMemory
424886ollelTeams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> #include "teams.h" using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; struct seg { int a, b; bool marked = false; seg(int A, int B) {a = A; b = B;} } vector<seg> s; void init(int n, int a[], int b[]) { s.resize(n); rep(i,0,n) { s[i].a = a[i]; s[i].b = b[i]; } sort(s.begin(), s.end(), [](seg x, seg y) { return x.b < y.b; }) } int can(int m, int k[]) { vi p(m); rep(i,0,m) p[i] = k[i]; sort(p.begin(), p.end()); rep(i,0,n) s[i].marked = false; rep(i,0,m) { int t = p[i], left = p[i]; rep(j, 0, n) { if((!s[j].marked) && s[j].a <= t && s[j].b >= t) { left--; s[j].marked = true; if (left == 0) break; } } if (left > 0) return 0; } return 1; }

Compilation message (stderr)

teams.cpp:19:13: error: invalid declarator before 's'
   19 | vector<seg> s;
      |             ^
teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:22:3: error: 's' was not declared in this scope
   22 |   s.resize(n);
      |   ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:36:11: error: 'n' was not declared in this scope
   36 |   rep(i,0,n) s[i].marked = false;
      |           ^
teams.cpp:6:39: note: in definition of macro 'rep'
    6 | #define rep(i,a,b) for(int i = a; i < b; i++)
      |                                       ^
teams.cpp:36:14: error: 's' was not declared in this scope
   36 |   rep(i,0,n) s[i].marked = false;
      |              ^
teams.cpp:40:15: error: 'n' was not declared in this scope
   40 |     rep(j, 0, n) {
      |               ^
teams.cpp:6:39: note: in definition of macro 'rep'
    6 | #define rep(i,a,b) for(int i = a; i < b; i++)
      |                                       ^
teams.cpp:41:12: error: 's' was not declared in this scope
   41 |       if((!s[j].marked) && s[j].a <= t && s[j].b >= t) {
      |            ^