# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13352 |
2015-02-13T12:52:55 Z |
gs14004 |
수족관 1 (KOI13_aqua1) |
C++14 |
|
16 ms |
1448 KB |
#include <cstdio>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
int x[2505], y[2505], hole[2505], n;
map<pi,int> mp;
int h;
int res;
int f(int s, int e){
if(s >= e) return 0;
int pos = (int)(min_element(y+s,y+e)-y);
int ph = h, ret = 0;
h = y[pos];
int r = f(s,pos);
r |= f(pos+1,e);
if(hole[pos] == 0 && !r){
res += (x[e] - x[s]) * (y[pos] - ph);
ret = 0;
}
else ret = 1;
h = ph;
return ret;
}
int main(){
scanf("%d",&n);
n/=2;
for (int i=0; i<n; i++) {
scanf("%*d %*d %d %d",&x[i],&y[i]);
mp[pi(x[i],y[i])] = i;
}
int t;
scanf("%d",&t);
for (int i=0; i<t; i++) {
int s,e;
scanf("%d %d %*d %*d",&s,&e);
hole[mp[pi(s,e)]] = 1;
}
f(0,n-1);
printf("%d",res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1244 KB |
Output is correct |
2 |
Correct |
0 ms |
1244 KB |
Output is correct |
3 |
Correct |
0 ms |
1244 KB |
Output is correct |
4 |
Correct |
0 ms |
1244 KB |
Output is correct |
5 |
Correct |
0 ms |
1244 KB |
Output is correct |
6 |
Correct |
0 ms |
1244 KB |
Output is correct |
7 |
Correct |
0 ms |
1244 KB |
Output is correct |
8 |
Correct |
0 ms |
1244 KB |
Output is correct |
9 |
Correct |
0 ms |
1244 KB |
Output is correct |
10 |
Correct |
0 ms |
1244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1244 KB |
Output is correct |
2 |
Correct |
0 ms |
1244 KB |
Output is correct |
3 |
Correct |
0 ms |
1244 KB |
Output is correct |
4 |
Correct |
0 ms |
1244 KB |
Output is correct |
5 |
Correct |
0 ms |
1244 KB |
Output is correct |
6 |
Correct |
0 ms |
1244 KB |
Output is correct |
7 |
Correct |
0 ms |
1244 KB |
Output is correct |
8 |
Correct |
0 ms |
1244 KB |
Output is correct |
9 |
Correct |
0 ms |
1244 KB |
Output is correct |
10 |
Correct |
0 ms |
1244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1244 KB |
Output is correct |
2 |
Correct |
0 ms |
1244 KB |
Output is correct |
3 |
Correct |
0 ms |
1244 KB |
Output is correct |
4 |
Correct |
0 ms |
1244 KB |
Output is correct |
5 |
Correct |
0 ms |
1244 KB |
Output is correct |
6 |
Correct |
0 ms |
1244 KB |
Output is correct |
7 |
Correct |
0 ms |
1244 KB |
Output is correct |
8 |
Correct |
0 ms |
1244 KB |
Output is correct |
9 |
Correct |
0 ms |
1244 KB |
Output is correct |
10 |
Correct |
0 ms |
1244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1244 KB |
Output is correct |
2 |
Correct |
0 ms |
1244 KB |
Output is correct |
3 |
Correct |
7 ms |
1376 KB |
Output is correct |
4 |
Correct |
0 ms |
1376 KB |
Output is correct |
5 |
Correct |
7 ms |
1376 KB |
Output is correct |
6 |
Correct |
16 ms |
1448 KB |
Output is correct |
7 |
Correct |
10 ms |
1376 KB |
Output is correct |
8 |
Correct |
9 ms |
1376 KB |
Output is correct |
9 |
Correct |
0 ms |
1376 KB |
Output is correct |
10 |
Correct |
0 ms |
1376 KB |
Output is correct |