Submission #598820

# Submission time Handle Problem Language Result Execution time Memory
598820 2022-07-19T06:07:38 Z 이동현(#8460) Building Skyscrapers (CEOI19_skyscrapers) C++17
0 / 100
3500 ms 5964 KB
#include <bits/stdc++.h>

using namespace std;

int wx[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, wy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    int n, t; cin >> n >> t;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i].first >> a[i].second;
    }
    map<int, map<int, int>> mp;
    vector<int> chk(n);
    vector<int> ans;

    for(int rep = 0; rep < n; ++rep){
        pair<int, int> now = {(int)2e9, (int)2e9};
        int pos = -1;
        for(int i = 0; i < n; ++i){
            if(chk[i]){
                continue;
            }
            int cnt = 0;
            for(int j = 0; j < 8; ++j){
                cnt += mp[a[i].first + wx[j]][a[i].second + wy[j]];
                if(cnt) break;
            }
            if(!cnt && rep) continue;
            if(a[i] < now){
                now = a[i];
                pos = i;
            }
        }
        if(now.first == (int)1e9){
            cout << "NO\n";
            return 0;
        }
        chk[pos] = 1;
        ans.push_back(pos);
        mp[a[pos].first][a[pos].second] = 1;
    }
    cout << "YES\n";
    for(auto&i:ans){
        cout << i + 1 << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Contestant did not find solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Contestant did not find solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Contestant did not find solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2236 ms 2992 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Contestant did not find solution
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3565 ms 5964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2236 ms 2992 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -