답안 #886597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886597 2023-12-12T11:28:22 Z vjudge1 Towers (NOI22_towers) C++17
6 / 100
597 ms 54100 KB
#include <bits/stdc++.h>

#define int long long int
#define MP make_pair
#define REP(i,n) for(int (i) = 0; (i)<(n); (i)++)
#define pb push_back

const int N = 1e6+5;
const int MOD = 1e9+7;
const int INF = 1e17;
using namespace std;

void fastio() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
}
int n,m,q;
struct Point {
    int x,y,id;
    Point() : x(0), y(0) {};
    Point(int xc, int yc) : x(xc), y(yc) {};
    void input(int ind) {
        id = ind;
        cin>>x>>y;
    }
    bool operator<(const Point &oth) {
        if(oth.x == x) return y < oth.y;
        return x < oth.x;
    }

};
vector<int> vis(N, 0);
void solve() {
    cin>>n;
    vector<Point> ps(n);
    REP(i,n) {
        ps[i].input(i);
    }
    sort(ps.begin(), ps.end());
    vector<int> res(n);
    for(int i = 0; i<n; i++) {
        if(vis[ps[i].y]) continue;
        res[ps[i].id] = 1;
        vis[ps[i].y] = 1;

    }
    vis.assign(N, 0);
    for(int i = n - 1; i>=0; i--) {
        if(vis[ps[i].y]) continue;
        res[ps[i].id] = 1;
        vis[ps[i].y] = 1;

    }
    REP(i,n) cout<<res[i];
    cout<<"\n";
}

signed main() {
    // fastio();
    solve();
}   

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:5:26: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define REP(i,n) for(int (i) = 0; (i)<(n); (i)++)
      |                          ^
Main.cpp:36:5: note: in expansion of macro 'REP'
   36 |     REP(i,n) {
      |     ^~~
Main.cpp:5:26: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define REP(i,n) for(int (i) = 0; (i)<(n); (i)++)
      |                          ^
Main.cpp:54:5: note: in expansion of macro 'REP'
   54 |     REP(i,n) cout<<res[i];
      |     ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8188 KB Output is correct
3 Correct 2 ms 8024 KB Output is correct
4 Correct 2 ms 8024 KB Output is correct
5 Incorrect 3 ms 8028 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8188 KB Output is correct
3 Correct 2 ms 8024 KB Output is correct
4 Correct 2 ms 8024 KB Output is correct
5 Incorrect 3 ms 8028 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 11220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 555 ms 40440 KB Output is correct
2 Correct 566 ms 52848 KB Output is correct
3 Correct 564 ms 52820 KB Output is correct
4 Correct 564 ms 52848 KB Output is correct
5 Correct 575 ms 53072 KB Output is correct
6 Correct 597 ms 53736 KB Output is correct
7 Correct 597 ms 54100 KB Output is correct
8 Correct 592 ms 53860 KB Output is correct
9 Correct 592 ms 54044 KB Output is correct
10 Correct 593 ms 53896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8188 KB Output is correct
3 Correct 2 ms 8024 KB Output is correct
4 Correct 2 ms 8024 KB Output is correct
5 Incorrect 3 ms 8028 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8188 KB Output is correct
3 Correct 2 ms 8024 KB Output is correct
4 Correct 2 ms 8024 KB Output is correct
5 Incorrect 3 ms 8028 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8188 KB Output is correct
3 Correct 2 ms 8024 KB Output is correct
4 Correct 2 ms 8024 KB Output is correct
5 Incorrect 3 ms 8028 KB Output isn't correct
6 Halted 0 ms 0 KB -