# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
5400 |
2014-04-30T10:40:53 Z |
Qwaz |
Trading (IZhO13_trading) |
C++ |
|
348 ms |
14576 KB |
#include <cstdio>
#include <set>
#include <algorithm>
using namespace std;
const int MAX = 300020;
struct events {
int pos, h;
bool open;
events() {}
events(int pos, int h, bool open) : pos(pos), h(h), open(open) {}
bool operator < (const events &t) const {
return pos < t.pos;
}
};
int n, m, eFull;
events eList[MAX<<1];
void input(){
scanf("%d%d", &n, &m);
int i;
for(i = 0; i<m; i++){
int l, r, p;
scanf("%d%d%d", &l, &r, &p);
eList[eFull++] = events(l, p-l, 1);
eList[eFull++] = events(r+1, p-l, 0);
}
sort(eList, eList+eFull);
}
multiset < int > st;
void solve(){
int i, j = 0;
for(i = 1; i<=n; i++){
while(j < eFull && eList[j].pos == i){
if(eList[j].open) st.insert(eList[j].h);
else st.erase(eList[j].h);
j++;
}
if(st.size() == 0) printf("0 ");
else {
multiset < int >::iterator it = st.end();
it--;
printf("%d ", *it+i);
}
}
puts("");
}
int main(){
input();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
8240 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
8240 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
8240 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
8240 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
8240 KB |
Output isn't correct |
6 |
Correct |
0 ms |
8240 KB |
Output is correct |
7 |
Incorrect |
164 ms |
10616 KB |
Output isn't correct |
8 |
Correct |
188 ms |
10352 KB |
Output is correct |
9 |
Correct |
192 ms |
11408 KB |
Output is correct |
10 |
Incorrect |
232 ms |
12992 KB |
Output isn't correct |
11 |
Correct |
220 ms |
10352 KB |
Output is correct |
12 |
Incorrect |
260 ms |
13520 KB |
Output isn't correct |
13 |
Incorrect |
232 ms |
11012 KB |
Output isn't correct |
14 |
Incorrect |
272 ms |
12728 KB |
Output isn't correct |
15 |
Correct |
280 ms |
12200 KB |
Output is correct |
16 |
Incorrect |
320 ms |
11144 KB |
Output isn't correct |
17 |
Correct |
304 ms |
12464 KB |
Output is correct |
18 |
Incorrect |
340 ms |
14576 KB |
Output isn't correct |
19 |
Correct |
328 ms |
12332 KB |
Output is correct |
20 |
Incorrect |
348 ms |
11936 KB |
Output isn't correct |