# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
749566 |
2023-05-28T08:26:35 Z |
반딧불(#9967) |
Towers (NOI22_towers) |
C++17 |
|
2000 ms |
29756 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Point{
int x, y, i;
Point(){}
Point(int x, int y, int i): x(x), y(y), i(i){}
bool operator<(const Point &r)const{
if(x!=r.x) return x<r.x;
return y<r.y;
}
};
int n;
Point arr[1000002];
int x[100002], y[100002];
bool ans[1000002];
int L[1000002], R[1000002], U[1000002], D[1000002];
bool good(int bit){
vector<bool> on (n);
for(int i=0; i<n; i++){
if((bit>>i)&1){
on[i] = 1;
L[y[i]] = min(L[y[i]], x[i]);
R[y[i]] = max(R[y[i]], x[i]);
D[x[i]] = min(D[x[i]], y[i]);
U[x[i]] = max(U[x[i]], y[i]);
}
}
bool ret = 1;
for(int i=0; i<n; i++){
if((bit>>i)&1) continue;
if(L[y[i]] < x[i] && x[i] < R[y[i]]) continue;
if(D[x[i]] < y[i] && y[i] < U[x[i]]) continue;
ret = 0;
}
for(int i=0; i<n; i++){
L[y[i]] = 1e9, R[y[i]] = 0;
D[x[i]] = 1e9, U[x[i]] = 0;
}
return ret;
}
int main(){
for(int i=0; i<=1000000; i++) L[i] = D[i] = 1e9, R[i] = U[i] = 0;
scanf("%d", &n);
for(int i=0; i<n; i++){
scanf("%d %d", &arr[i].x, &arr[i].y);
arr[i].i = i;
x[i] = arr[i].x, y[i] = arr[i].y;
}
for(int b=0; b<(1<<n); b++) if(good(b)){
for(int i=0; i<n; i++) if((b>>i)&1) ans[i] = 1;
break;
}
for(int i=0; i<n; i++) printf("%d", ans[i]);
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:54:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
54 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
Main.cpp:56:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
56 | scanf("%d %d", &arr[i].x, &arr[i].y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
15956 KB |
Output is correct |
2 |
Correct |
7 ms |
15884 KB |
Output is correct |
3 |
Correct |
9 ms |
15956 KB |
Output is correct |
4 |
Correct |
7 ms |
15956 KB |
Output is correct |
5 |
Correct |
7 ms |
15916 KB |
Output is correct |
6 |
Correct |
8 ms |
15916 KB |
Output is correct |
7 |
Correct |
8 ms |
15956 KB |
Output is correct |
8 |
Correct |
8 ms |
15956 KB |
Output is correct |
9 |
Correct |
7 ms |
15956 KB |
Output is correct |
10 |
Correct |
9 ms |
15956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
15956 KB |
Output is correct |
2 |
Correct |
7 ms |
15884 KB |
Output is correct |
3 |
Correct |
9 ms |
15956 KB |
Output is correct |
4 |
Correct |
7 ms |
15956 KB |
Output is correct |
5 |
Correct |
7 ms |
15916 KB |
Output is correct |
6 |
Correct |
8 ms |
15916 KB |
Output is correct |
7 |
Correct |
8 ms |
15956 KB |
Output is correct |
8 |
Correct |
8 ms |
15956 KB |
Output is correct |
9 |
Correct |
7 ms |
15956 KB |
Output is correct |
10 |
Correct |
9 ms |
15956 KB |
Output is correct |
11 |
Correct |
20 ms |
15976 KB |
Output is correct |
12 |
Correct |
10 ms |
15956 KB |
Output is correct |
13 |
Correct |
22 ms |
15976 KB |
Output is correct |
14 |
Correct |
19 ms |
15980 KB |
Output is correct |
15 |
Incorrect |
19 ms |
15976 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2052 ms |
17748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
282 ms |
29756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
15956 KB |
Output is correct |
2 |
Correct |
7 ms |
15884 KB |
Output is correct |
3 |
Correct |
9 ms |
15956 KB |
Output is correct |
4 |
Correct |
7 ms |
15956 KB |
Output is correct |
5 |
Correct |
7 ms |
15916 KB |
Output is correct |
6 |
Correct |
8 ms |
15916 KB |
Output is correct |
7 |
Correct |
8 ms |
15956 KB |
Output is correct |
8 |
Correct |
8 ms |
15956 KB |
Output is correct |
9 |
Correct |
7 ms |
15956 KB |
Output is correct |
10 |
Correct |
9 ms |
15956 KB |
Output is correct |
11 |
Correct |
20 ms |
15976 KB |
Output is correct |
12 |
Correct |
10 ms |
15956 KB |
Output is correct |
13 |
Correct |
22 ms |
15976 KB |
Output is correct |
14 |
Correct |
19 ms |
15980 KB |
Output is correct |
15 |
Incorrect |
19 ms |
15976 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
15956 KB |
Output is correct |
2 |
Correct |
7 ms |
15884 KB |
Output is correct |
3 |
Correct |
9 ms |
15956 KB |
Output is correct |
4 |
Correct |
7 ms |
15956 KB |
Output is correct |
5 |
Correct |
7 ms |
15916 KB |
Output is correct |
6 |
Correct |
8 ms |
15916 KB |
Output is correct |
7 |
Correct |
8 ms |
15956 KB |
Output is correct |
8 |
Correct |
8 ms |
15956 KB |
Output is correct |
9 |
Correct |
7 ms |
15956 KB |
Output is correct |
10 |
Correct |
9 ms |
15956 KB |
Output is correct |
11 |
Correct |
20 ms |
15976 KB |
Output is correct |
12 |
Correct |
10 ms |
15956 KB |
Output is correct |
13 |
Correct |
22 ms |
15976 KB |
Output is correct |
14 |
Correct |
19 ms |
15980 KB |
Output is correct |
15 |
Incorrect |
19 ms |
15976 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
15956 KB |
Output is correct |
2 |
Correct |
7 ms |
15884 KB |
Output is correct |
3 |
Correct |
9 ms |
15956 KB |
Output is correct |
4 |
Correct |
7 ms |
15956 KB |
Output is correct |
5 |
Correct |
7 ms |
15916 KB |
Output is correct |
6 |
Correct |
8 ms |
15916 KB |
Output is correct |
7 |
Correct |
8 ms |
15956 KB |
Output is correct |
8 |
Correct |
8 ms |
15956 KB |
Output is correct |
9 |
Correct |
7 ms |
15956 KB |
Output is correct |
10 |
Correct |
9 ms |
15956 KB |
Output is correct |
11 |
Correct |
20 ms |
15976 KB |
Output is correct |
12 |
Correct |
10 ms |
15956 KB |
Output is correct |
13 |
Correct |
22 ms |
15976 KB |
Output is correct |
14 |
Correct |
19 ms |
15980 KB |
Output is correct |
15 |
Incorrect |
19 ms |
15976 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |