Submission #432191

#TimeUsernameProblemLanguageResultExecution timeMemory
432191Pichon5Aliens (IOI16_aliens)C++17
0 / 100
1 ms288 KiB
#include "aliens.h" #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define vi vector<int> using namespace std; const int tam=505; int P[tam]; long long take_photos(int n, int m, int k,vi r,vi c){ set<pair<int,int> >st; for(int i=0;i<n;i++){ st.insert({r[i],r[i]}); } n=st.size(); for(int i=0;i<n-k;i++){ int mi=1e9; int ant=-600; set<pair<int,int> > :: iterator A,B,curr; curr=st.begin(); for(auto it : st){ if(it.S-ant+1<mi){ A=curr; B=st.find(it); mi=it.S-ant+1; } ant=it.F; curr=st.find(it); } int be=(*A).F; int en=(*B).S; st.erase(A);st.erase(B); st.insert({be,en}); } int res=0; for(auto it : st){ int tam=it.S-it.F+1; res+=tam*tam; } 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...