# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89111 | 2018-12-10T10:29:10 Z | nika | Trading (IZhO13_trading) | C++14 | 482 ms | 66172 KB |
#include <bits/stdc++.h> using namespace std; const int N = 300*1000+5; vector<pair<int,int> > op[N]; vector<pair<int,int> > cl[N]; int a[N]; int main(){ int n,m; scanf("%d%d",&n,&m); vector<pair<pair<int,int>,int > > v; for(int i = 0;i<m;i++){ int l,r,x; scanf("%d%d%d",&l,&r,&x); op[l].push_back({x,i}); cl[r].push_back({x,i}); v.push_back({{l,r},x}); } set<pair<int,int> > ms; for(int i = 1;i<=n;i++){ for(int j = 0;j<op[i].size();j++){ int id = op[i][j].first-i; ms.insert({id,op[i][j].second}); } if(ms.size() == 0) continue; set<pair<int,int> >::iterator it = (--ms.end()); pair<int,int> now = *it; a[i] = v[now.second].second+(i-v[now.second].first.first); // printf("%d ",a[i]); for(int j = 0;j<cl[i].size();j++){ int id = cl[i][j].first-v[cl[i][j].second].first.first; ms.erase({id,cl[i][j].second}); } } for(int i = 1;i<=n;i++) printf("%d ",a[i]); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 14584 KB | Output is correct |
2 | Correct | 16 ms | 14584 KB | Output is correct |
3 | Correct | 17 ms | 14816 KB | Output is correct |
4 | Correct | 16 ms | 14932 KB | Output is correct |
5 | Correct | 18 ms | 15048 KB | Output is correct |
6 | Correct | 20 ms | 15200 KB | Output is correct |
7 | Correct | 270 ms | 29332 KB | Output is correct |
8 | Correct | 300 ms | 33228 KB | Output is correct |
9 | Correct | 303 ms | 37196 KB | Output is correct |
10 | Correct | 364 ms | 41552 KB | Output is correct |
11 | Correct | 305 ms | 45796 KB | Output is correct |
12 | Correct | 405 ms | 52072 KB | Output is correct |
13 | Correct | 420 ms | 55068 KB | Output is correct |
14 | Correct | 422 ms | 60760 KB | Output is correct |
15 | Runtime error | 482 ms | 66172 KB | Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience. |
16 | Halted | 0 ms | 0 KB | - |