Submission #819026

#TimeUsernameProblemLanguageResultExecution timeMemory
819026vjudge1Aliens (IOI16_aliens)C++17
4 / 100
1 ms300 KiB
#include<bits/stdc++.h> #include "aliens.h" using namespace std; using ll = long long; ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<pair<ll, ll>> a; for(int i = 0; i < n; i++) { if(r[i] > c[i]) swap(r[i], c[i]); a.push_back({r[i], c[i]}); } sort(a.begin(), a.end()); ll mx = -1; ll res = 0; for(auto [r, c] : a) { if(c <= mx) continue; res += (c - r + 1) * (c - r + 1); if(mx >= r) res -= (mx - r + 1) * (mx - r + 1); mx = max(mx, c); } return res; }
#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...