답안 #758058

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
758058 2023-06-14T06:00:53 Z roCatalyst Towers (NOI22_towers) C++14
0 / 100
913 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;

vector<string> all;

void generate(string s, int N){
    if (N == 0) {
        all.push_back(s);
    } else {
        generate(s+'1',N-1);
        generate(s+'0',N-1);
    }
}

/*
all_perms = []

def generate(s,N):
    if N == 0:
        all_perms.append(s)
    else:
        generate(s+'0',N-1)
        generate(s+'1',N-1)

N = int(input())

generate("",N)
print(all_perms)
*/

int main() {
    int N;
    cin >> N;  
    /*generate("",N);*/


    vector<pair<int,int>> cities;

    int maxX = -1;
    int maxY = -1;
    for (int i = 0; i < N; i++) {
        int xi;
        int yi;
        cin >> xi >> yi;
        maxX = max(xi,maxX);
        maxY = max(yi,maxY);
        cities.push_back(make_pair(xi,yi));
    }

    int coords[maxX][maxY];
    for (int i = 0; i < maxX; i++) {
        for (int j = 0; j < maxY; j++) {
            coords[i][j] = -1;
        }
    }
    for (int i = 0; i < N; i++) {
        pair<int,int> ci = cities[i];

        coords[ci.first-1][ci.second-1] = i;
    }

    bool ans[N];

    for (int i = 0; i < maxX; i++) {
        int start = -1;
        int end = -1;
        for (int j = 0; j < maxY; j++) {
            int curr = coords[i][j];
            if (curr) {
                if (start != -1) {
                    start = curr;
                }
                end = curr;
            }
            ans[curr] = true;
        }
    }


    for (int i = 0; i < N; i++) {
        cout << ans[i];
    }
    cout << endl;


}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:66:13: warning: variable 'end' set but not used [-Wunused-but-set-variable]
   66 |         int end = -1;
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 678 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 678 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 1608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 913 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 678 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 678 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 678 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -