# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
749490 | 2023-05-28T05:48:45 Z | 반딧불(#9967) | Towers (NOI22_towers) | C++17 | 416 ms | 38852 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]; vector<int> vec[1000002]; bool ans[1000002]; void put(int i){ int y = arr[i].y; if((int)vec[y].size() == 2){ ans[vec[y].back()] = 0; vec[y].pop_back(); } vec[y].push_back(arr[i].i); ans[arr[i].i] = 1; } int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d %d", &arr[i].x, &arr[i].y), arr[i].i = i; sort(arr+1, arr+n+1); for(int i=1; i<=n; i++){ int j = i; while(j+1 <= n && arr[i].x == arr[j+1].x) j++; put(i), put(j); i=j; } for(int i=1; i<=n; i++) printf("%d", ans[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23764 KB | Output is correct |
3 | Correct | 13 ms | 23764 KB | Output is correct |
4 | Correct | 12 ms | 23740 KB | Output is correct |
5 | Correct | 12 ms | 23780 KB | Output is correct |
6 | Correct | 13 ms | 23772 KB | Output is correct |
7 | Correct | 12 ms | 23764 KB | Output is correct |
8 | Incorrect | 13 ms | 23764 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23764 KB | Output is correct |
3 | Correct | 13 ms | 23764 KB | Output is correct |
4 | Correct | 12 ms | 23740 KB | Output is correct |
5 | Correct | 12 ms | 23780 KB | Output is correct |
6 | Correct | 13 ms | 23772 KB | Output is correct |
7 | Correct | 12 ms | 23764 KB | Output is correct |
8 | Incorrect | 13 ms | 23764 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 24956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 416 ms | 38852 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23764 KB | Output is correct |
3 | Correct | 13 ms | 23764 KB | Output is correct |
4 | Correct | 12 ms | 23740 KB | Output is correct |
5 | Correct | 12 ms | 23780 KB | Output is correct |
6 | Correct | 13 ms | 23772 KB | Output is correct |
7 | Correct | 12 ms | 23764 KB | Output is correct |
8 | Incorrect | 13 ms | 23764 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23764 KB | Output is correct |
3 | Correct | 13 ms | 23764 KB | Output is correct |
4 | Correct | 12 ms | 23740 KB | Output is correct |
5 | Correct | 12 ms | 23780 KB | Output is correct |
6 | Correct | 13 ms | 23772 KB | Output is correct |
7 | Correct | 12 ms | 23764 KB | Output is correct |
8 | Incorrect | 13 ms | 23764 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 23764 KB | Output is correct |
2 | Correct | 12 ms | 23764 KB | Output is correct |
3 | Correct | 13 ms | 23764 KB | Output is correct |
4 | Correct | 12 ms | 23740 KB | Output is correct |
5 | Correct | 12 ms | 23780 KB | Output is correct |
6 | Correct | 13 ms | 23772 KB | Output is correct |
7 | Correct | 12 ms | 23764 KB | Output is correct |
8 | Incorrect | 13 ms | 23764 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |