Submission #390437

#TimeUsernameProblemLanguageResultExecution timeMemory
390437ponytailAliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #define int long long #define fi first #define se second #define pb push_back using namespace std; const int BIG = 1e18; const int is_query = -BIG; struct line { int m, b; mutable function<const line*()> succ; bool operator<(const line& rhs) const { if (rhs.b != is_query) return m < rhs.m; const line* s = succ(); if (!s) return 0; int x = rhs.m; return b - s->b < (s->m - m) * x; } }; struct dynamic_hull : public multiset<line> { const int inf = BIG; bool bad(iterator y) { auto z = next(y); if (y == begin()) { if (z == end()) return 0; return y->m == z->m && y->b <= z->b; } auto x = prev(y); if (z == end()) return y->m == x->m && y->b <= x->b; int v1 = (x->b - y->b); if (y->m == x->m) v1 = x->b > y->b ? inf : -inf; else v1 /= (y->m - x->m); int v2 = (y->b - z->b); if (z->m == y->m) v2 = y->b > z->b ? inf : -inf; else v2 /= (z->m - y->m); return v1 >= v2; } void insert_line(int m, int b) { auto y = insert({m,b}); y->succ = [=] { return next(y) == end() ? 0 : &*next(y); }; if (bad(y)) { erase(y); return; } while (next(y) != end() && bad(next(y))) erase(next(y)); while (y != begin() && bad(prev(y))) erase(prev(y)); } int eval(int x) { auto l = *lower_bound((line) { x, is_query }); return l.m * x + l.b; } }; int N,M,K; int take_photos(int N,int M,int K,vector<int>r, vector<int>c){ int occupied[M][M]; for(int i=0;i<M;i++){ for(int j=0;j<M;j++){ occupied[i][j]=0; } } for(int i=0;i<N;i++){ for(int j=min(r[i],c[i]);j<=max(r[i],c[i]);j++){ for(int k=min(r[i],c[i]);k<=max(r[i],c[i]);k++){ occupied[j][k]=1; } } } int ans=0; for(int i=0;i<M;i++){ for(int j=0;j<M;j++){ ans+=occupied[i][j]; } } return ans; } int32_t main(){ cin >> N >> M >> K; vector<int> r, c; for(int i=0;i<N;i++){ int wow, no; cin >> wow >> no; r.pb(wow); c.pb(no); } cout << take_photos(N, M, K, r, c) << "\n"; }

Compilation message (stderr)

/tmp/ccpYJnxS.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccbiAANU.o:aliens.cpp:(.text.startup+0x0): first defined here
/tmp/ccpYJnxS.o: In function `main':
grader.cpp:(.text.startup+0xf0): undefined reference to `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status