# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
289140 |
2020-09-02T12:05:56 Z |
stoyan_malinin |
Wall (IOI14_wall) |
C++14 |
|
3000 ms |
14004 KB |
#include "wall.h"
//#include "grader.cpp"
#include <vector>
#include <iostream>
const int MAXN = 1e5 + 5;
struct Range
{
int l, r;
Range(){}
Range(int l, int r)
{
this->l = l;
this->r = r;
}
int f(int x)
{
if(x<=l) return l;
if(x>=r) return r;
return x;
}
};
Range Merge(Range first, Range second)
{
if(second.l>=first.r) return Range(second.l, second.l);
if(second.r<=first.l) return Range(second.r, second.r);
if(second.l<=first.l && first.r<=second.r) return Range(first.l, first.r);
if(first.l<=second.l && second.r<=first.r) return Range(second.l, second.r);
if(first.l<=second.l && first.r<=second.r && second.l<=first.r) return Range(second.l, first.r);
if(second.l<=first.l && second.r<=first.r && first.l<=second.r) return Range(first.l, second.r);
}
void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[])
{
for(int ind = 0;ind<n;ind++)
{
Range ans = Range(0, MAXN);
for(int i = 0;i<k;i++)
{
if(ind<left[i] || ind>right[i]) continue;
if(op[i]==1) ans = Merge(ans, Range(height[i], MAXN));
else ans = Merge(ans, Range(0, height[i]));
}
finalHeight[ind] = ans.f(0);
}
}
Compilation message
wall.cpp: In function 'Range Merge(Range, Range)':
wall.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
36 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
245 ms |
632 KB |
Output is correct |
5 |
Correct |
92 ms |
636 KB |
Output is correct |
6 |
Correct |
89 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Correct |
174 ms |
13988 KB |
Output is correct |
3 |
Execution timed out |
3088 ms |
7032 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
245 ms |
560 KB |
Output is correct |
5 |
Correct |
89 ms |
512 KB |
Output is correct |
6 |
Correct |
90 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
171 ms |
14004 KB |
Output is correct |
9 |
Execution timed out |
3085 ms |
7036 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
249 ms |
632 KB |
Output is correct |
5 |
Correct |
89 ms |
512 KB |
Output is correct |
6 |
Correct |
92 ms |
632 KB |
Output is correct |
7 |
Correct |
0 ms |
256 KB |
Output is correct |
8 |
Correct |
169 ms |
14000 KB |
Output is correct |
9 |
Execution timed out |
3040 ms |
7032 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |