Submission #928330

#TimeUsernameProblemLanguageResultExecution timeMemory
928330ttamxAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
686 ms39508 KiB
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<pair<int,int>> a(n); for(auto &[x,e]:a)cin >> x >> e; sort(a.begin(),a.end()); a.erase(unique(a.begin(),a.end()),a.end()); n=a.size(); vector<int> ok(n,1); for(int t=0;t<2;t++){ set<int> s; for(int i=0;i<n;i++){ auto [x,e]=a[i]; int val=e+(t?-x:x); if(s.lower_bound(val)!=s.end())ok[i]=0; s.emplace(val); } reverse(a.begin(),a.end()); reverse(ok.begin(),ok.end()); } cout << accumulate(ok.begin(),ok.end(),0); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   10 |     for(auto &[x,e]:a)cin >> x >> e;
      |               ^
Main.cpp:18:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |             auto [x,e]=a[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...