Submission #972808

#TimeUsernameProblemLanguageResultExecution timeMemory
972808simona1230New Home (APIO18_new_home)C++17
0 / 100
155 ms71348 KiB
#include <bits/stdc++.h> using namespace std; const int maxv=1e8; const int maxn=3*1e5; int n,q,k; vector<int> pos[maxn]; struct store { int x,a,b,t; store(){} store(int _x,int _t,int _a,int _b) { x=_x; t=_t; a=_a; b=_b; } }; store s[maxn]; vector<int> qr[maxn]; void read() { cin>>n>>k>>q; for(int i=1;i<=n;i++) { int x,a,b,t; cin>>x>>t>>a>>b; pos[t].push_back(x); s[i]={x,t,a,b}; } for(int i=1;i<=k;i++) sort(pos[i].begin(),pos[i].end()); for(int i=1;i<=q;i++) { int x,y; cin>>x>>y; qr[x].push_back(i); } } int ans[maxn]; vector<int> change[maxn]; multiset<int> curr; int idx[maxn]; /*void solve() { for(int i=1;i<=k;i++) { curr.insert(pos[i][0]); if(pos[i].size()==0)continue; int x=pos[i][0],y=pos[i][1]; int nxt=(y+x+1)/2; change[nxt].push_back(i); } for(int i=1;i<=0;i++) { for(int j=0;j<change[i].size();j++) { int x=change[i][j]; int old=pos[x][idx[x]]; curr.erase(curr.find(old)); idx[x]++; int nw=pos[x][idx[x]]; curr.insert(nw); if(idx[x]!=pos[x].size()-1) { int nxt=pos[x][idx[x]+1]; change[(nw+nxt+1)/2].push_back(x); } } int here=max(i-*curr.begin(),*curr.rbegin()-i); for(int j=0;j<qr[i].size();j++) { ans[qr[i][j]]=here; } } for(int i=1;i<=q;i++) cout<<ans[i]<<endl; }*/ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); read(); //solve(); return 0; } /* 4 2 4 3 1 1 10 9 2 2 4 7 2 5 7 4 1 8 10 1 1 5 1 6 1 10 1 4 2 4 3 1 1 10 9 2 2 4 7 2 5 7 4 1 8 10 1 1 5 1 6 1 10 1 4 2 4 4 -> 1 8 -> 2 1 1 2 10 */
#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...