# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495290 | 2021-12-18T08:48:35 Z | White | Trading (IZhO13_trading) | C++14 | 478 ms | 30800 KB |
#pragma GCC optimize("O3") #include<bits/stdc++.h> #define endl "\n" using namespace std; multiset<long long>a; vector<long long>L[300001],R[300001]; int main(){ long long n,m,l,r,x; cin>>n>>m; for(long long i=0;i<m;i++){ cin>>l>>r>>x; l--;r--; L[l].push_back(x-l); R[r].push_back(x-l); } for(long long i=0;i<n;i++){ for(long long j=0;j<L[i].size();j++){ a.insert(L[i][j]); } if(a.empty()==true){ cout<<"0 "; }else{ multiset<long long>::iterator it=a.end(); it--; cout<<*it+i<<" "; } for(long long j=0;j<R[i].size();j++){ a.erase(a.find(R[i][j])); } } cout<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 14364 KB | Output is correct |
2 | Correct | 9 ms | 14284 KB | Output is correct |
3 | Correct | 8 ms | 14284 KB | Output is correct |
4 | Correct | 9 ms | 14412 KB | Output is correct |
5 | Correct | 10 ms | 14388 KB | Output is correct |
6 | Correct | 13 ms | 14500 KB | Output is correct |
7 | Correct | 253 ms | 23348 KB | Output is correct |
8 | Correct | 312 ms | 24136 KB | Output is correct |
9 | Correct | 263 ms | 24588 KB | Output is correct |
10 | Correct | 284 ms | 25256 KB | Output is correct |
11 | Correct | 290 ms | 25520 KB | Output is correct |
12 | Correct | 361 ms | 27580 KB | Output is correct |
13 | Correct | 337 ms | 26168 KB | Output is correct |
14 | Correct | 317 ms | 27560 KB | Output is correct |
15 | Correct | 385 ms | 27900 KB | Output is correct |
16 | Correct | 392 ms | 27700 KB | Output is correct |
17 | Correct | 412 ms | 28300 KB | Output is correct |
18 | Correct | 471 ms | 30800 KB | Output is correct |
19 | Correct | 412 ms | 28328 KB | Output is correct |
20 | Correct | 478 ms | 30508 KB | Output is correct |