Submission #886597

#TimeUsernameProblemLanguageResultExecution timeMemory
886597vjudge1Towers (NOI22_towers)C++17
6 / 100
597 ms54100 KiB
#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 (stderr)

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];
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...