# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775559 | 2023-07-06T13:57:50 Z | Trumling | Wall (IOI14_wall) | C++14 | 208 ms | 31640 KB |
#include "wall.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 99999999999999999 #define MOD 1000000007 #define all(x) x.begin(),x.end() void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ vector<pair<int,pair<int,int>>>v; for(int i=0;i<k;i++) { if(op[i]==2) break; v.pb({left[i],{height[i],right[i]}}); } sort(all(v)); ll idx=0; priority_queue<pair<int,int>>pq; for(int i=0;i<n;i++) { while(idx<v.size() && v[idx].F==i) { pq.push({v[idx].S.F,v[idx].S.S}); idx++; } while(!pq.empty() && pq.top().S<i) pq.pop(); if(!pq.empty()) finalHeight[i]=pq.top().F; } while(!pq.empty()) pq.pop(); v.clear(); for(int i=0;i<k;i++) { if(op[i]==1) continue; v.pb({left[i],{height[i],right[i]}}); } sort(all(v)); idx=0; for(int i=0;i<n;i++) { while(idx<v.size() && v[idx].F==i) { pq.push({-v[idx].S.F,v[idx].S.S}); idx++; } while(!pq.empty() && pq.top().S<i) pq.pop(); if(!pq.empty()) finalHeight[i]=min(-pq.top().F,finalHeight[i]); } return; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 3 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 195 ms | 20144 KB | Output is correct |
3 | Correct | 99 ms | 10208 KB | Output is correct |
4 | Correct | 199 ms | 19248 KB | Output is correct |
5 | Correct | 208 ms | 31640 KB | Output is correct |
6 | Correct | 194 ms | 27264 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 2 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 300 KB | Output is correct |
2 | Incorrect | 2 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |