제출 #432192

#제출 시각아이디문제언어결과실행 시간메모리
432192Pichon5Aliens (IOI16_aliens)C++17
0 / 100
1 ms204 KiB
#include "aliens.h" #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define vi vector<int> #define ll long long using namespace std; long long take_photos(int n, int m, int k,vi r,vi c){ set<pair<ll,ll> >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++){ ll mi=1e18; ll ant=-100000; set<pair<ll,ll> > :: 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); } ll be=(*A).F; ll en=(*B).S; st.erase(A);st.erase(B); st.insert({be,en}); } ll res=0; for(auto it : st){ ll 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...