답안 #749560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
749560 2023-05-28T08:19:58 Z 반딧불(#9967) Towers (NOI22_towers) C++17
7 / 100
236 ms 24692 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, a, b;
Point arr[1000002];
bool ans[1000002];

int get(int x, int y){
    return (x-1)*b+y;
}

void cover(int x1, int x2, int y1, int y2){
    if(x1>x2 || y1>y2) return;
    ans[get(x1, y1)] = 1;
    ans[get(x1, y2)] = 1;
    ans[get(x2, y1)] = 1;
    ans[get(x2, y2)] = 1;
    cover(x1+1, x2-1, y1+1, y2-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;

    a = arr[n].x, b = arr[n].y;
    cover(1, a, 1, b);

    for(int i=1; i<=n; i++) printf("%d", ans[i]);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:36:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:37:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     for(int i=1; i<=n; i++) scanf("%d %d", &arr[i].x, &arr[i].y), arr[i].i = i;
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2056 KB Output is correct
2 Correct 24 ms 2356 KB Output is correct
3 Correct 78 ms 5364 KB Output is correct
4 Correct 153 ms 9952 KB Output is correct
5 Correct 26 ms 2384 KB Output is correct
6 Correct 6 ms 724 KB Output is correct
7 Correct 144 ms 9560 KB Output is correct
8 Correct 92 ms 6688 KB Output is correct
9 Correct 214 ms 13864 KB Output is correct
10 Correct 177 ms 11964 KB Output is correct
11 Correct 236 ms 14836 KB Output is correct
12 Correct 230 ms 14648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 180 ms 24692 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -