Submission #433477

#TimeUsernameProblemLanguageResultExecution timeMemory
433477MonchitoAliens (IOI16_aliens)C++14
0 / 100
1 ms292 KiB
#include "aliens.h" #include <algorithm> #include <cstring> using namespace std; using ll = long long; struct point{ int r, c; bool operator<(const point& p) const { if(r != p.r) return r < p.r; return c > p.c; } }; const int MAXM = 100, MAXN = 50; bool a[MAXM][MAXM]; point interest[MAXN]; ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) { memset(a, false, sizeof(a)); for(int i=0; i<n; i++) interest[i] = { r[i], c[i] }; sort(interest, interest+n); ll ret = 0; for(point x : interest) { if(a[x.r][x.c]) continue; point p1 = { x.r, x.r }, p2 = { x.c, x.c }; if(p1.r > p2.r) { swap(p1.r, p2.r); swap(p1.c, p2.c); } for(int i = p1.r; i <= p2.r; i++) { for(int j=p1.c; j <= p2.c; j++) { if(a[i][j]) continue; a[i][j] = true; ret++; } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...