답안 #749492

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
749492 2023-05-28T05:53:23 Z 반딧불(#9967) Towers (NOI22_towers) C++17
11 / 100
622 ms 57512 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);
        if(i!=j) put(j);
        i=j;
    }
    for(int i=1; i<=n; i++) printf("%d", ans[i]);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:35:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |     for(int i=1; i<=n; i++) scanf("%d %d", &arr[i].x, &arr[i].y), arr[i].i = i;
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23748 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 12 ms 23764 KB Output is correct
4 Correct 12 ms 23760 KB Output is correct
5 Correct 12 ms 23764 KB Output is correct
6 Correct 13 ms 23724 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 12 ms 23676 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23748 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 12 ms 23764 KB Output is correct
4 Correct 12 ms 23760 KB Output is correct
5 Correct 12 ms 23764 KB Output is correct
6 Correct 13 ms 23724 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 12 ms 23676 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 13 ms 23764 KB Output is correct
12 Correct 13 ms 23764 KB Output is correct
13 Incorrect 12 ms 23764 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 25160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 448 ms 38792 KB Output is correct
2 Correct 413 ms 38932 KB Output is correct
3 Correct 430 ms 38876 KB Output is correct
4 Correct 406 ms 38920 KB Output is correct
5 Correct 409 ms 38936 KB Output is correct
6 Correct 622 ms 57216 KB Output is correct
7 Correct 612 ms 57512 KB Output is correct
8 Correct 621 ms 57228 KB Output is correct
9 Correct 611 ms 57400 KB Output is correct
10 Correct 601 ms 57280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23748 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 12 ms 23764 KB Output is correct
4 Correct 12 ms 23760 KB Output is correct
5 Correct 12 ms 23764 KB Output is correct
6 Correct 13 ms 23724 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 12 ms 23676 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 13 ms 23764 KB Output is correct
12 Correct 13 ms 23764 KB Output is correct
13 Incorrect 12 ms 23764 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23748 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 12 ms 23764 KB Output is correct
4 Correct 12 ms 23760 KB Output is correct
5 Correct 12 ms 23764 KB Output is correct
6 Correct 13 ms 23724 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 12 ms 23676 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 13 ms 23764 KB Output is correct
12 Correct 13 ms 23764 KB Output is correct
13 Incorrect 12 ms 23764 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23748 KB Output is correct
2 Correct 12 ms 23764 KB Output is correct
3 Correct 12 ms 23764 KB Output is correct
4 Correct 12 ms 23760 KB Output is correct
5 Correct 12 ms 23764 KB Output is correct
6 Correct 13 ms 23724 KB Output is correct
7 Correct 14 ms 23892 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 12 ms 23676 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 13 ms 23764 KB Output is correct
12 Correct 13 ms 23764 KB Output is correct
13 Incorrect 12 ms 23764 KB Output isn't correct
14 Halted 0 ms 0 KB -