Submission #886498

# Submission time Handle Problem Language Result Execution time Memory
886498 2023-12-12T08:56:27 Z vjudge1 Towers (NOI22_towers) C++17
0 / 100
679 ms 99732 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(aa) aa.begin(), aa.end()

int main(){
    int n;
    cin>>n;

    vector<pair<int, int>> city;
    vector<bool> ans(n);
    vector<vector<int>> c(1000000), r(1000000);
    for(int i=0; i<n; i++){
        int a, b;
        cin>>a>>b;
        a--; b--;

        c[a].push_back(i);
        r[b].push_back(i);
        city.emplace_back(a, b);
    }

    for(int i=0; i<1000000; i++){
        if(!c[i].size()) continue;
        int minn=0, maxx=0;
        for(auto j:c[i]){
            if(city[j].second>city[maxx].second) maxx=j;
            if(city[j].second<city[minn].second) minn=j;
        }

        ans[minn]=1;
        ans[maxx]=1;
    }
    for(int i=0; i<1000000; i++){
        if(!c[i].size()) continue;
        int minn=0, maxx=0;
        for(auto j:c[i]){
            if(city[j].first>city[maxx].first) maxx=j;
            if(city[j].first<city[minn].first) minn=j;
        }

        ans[minn]=1;
        ans[maxx]=1;
    }

    for(auto e:ans) cout<<e;
}
# Verdict Execution time Memory Grader output
1 Correct 17 ms 47192 KB Output is correct
2 Correct 15 ms 47196 KB Output is correct
3 Correct 15 ms 47420 KB Output is correct
4 Correct 15 ms 47196 KB Output is correct
5 Correct 16 ms 47196 KB Output is correct
6 Correct 15 ms 47452 KB Output is correct
7 Incorrect 15 ms 47192 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 47192 KB Output is correct
2 Correct 15 ms 47196 KB Output is correct
3 Correct 15 ms 47420 KB Output is correct
4 Correct 15 ms 47196 KB Output is correct
5 Correct 16 ms 47196 KB Output is correct
6 Correct 15 ms 47452 KB Output is correct
7 Incorrect 15 ms 47192 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 50072 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 679 ms 99732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 47192 KB Output is correct
2 Correct 15 ms 47196 KB Output is correct
3 Correct 15 ms 47420 KB Output is correct
4 Correct 15 ms 47196 KB Output is correct
5 Correct 16 ms 47196 KB Output is correct
6 Correct 15 ms 47452 KB Output is correct
7 Incorrect 15 ms 47192 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 47192 KB Output is correct
2 Correct 15 ms 47196 KB Output is correct
3 Correct 15 ms 47420 KB Output is correct
4 Correct 15 ms 47196 KB Output is correct
5 Correct 16 ms 47196 KB Output is correct
6 Correct 15 ms 47452 KB Output is correct
7 Incorrect 15 ms 47192 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 47192 KB Output is correct
2 Correct 15 ms 47196 KB Output is correct
3 Correct 15 ms 47420 KB Output is correct
4 Correct 15 ms 47196 KB Output is correct
5 Correct 16 ms 47196 KB Output is correct
6 Correct 15 ms 47452 KB Output is correct
7 Incorrect 15 ms 47192 KB Output isn't correct
8 Halted 0 ms 0 KB -