Submission #1295912

#TimeUsernameProblemLanguageResultExecution timeMemory
1295912nathako9nLightning Rod (NOI18_lightningrod)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e7+2; pair<int,int> ar[N+2]; int n; vector<int>pos; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); for(int i =1;i<=n;i++){ int x, y; cin >> x >> y; ar[i]= {x+y, x-y}; } sort(ar+1, ar+n+1, greater<pair<int,int>>) vector<int> tail; for(int i=0;i<n;i++){ int val = ar[i+1].second; auto it = lower_bound(tail.begin(), tail.end(), -val); if(it==tail.end()) tail.push_back(-val); else *it = -val; } cout<<tail.size()<<"\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:16:50: error: expected primary-expression before ')' token
   16 |         sort(ar+1, ar+n+1, greater<pair<int,int>>)
      |                                                  ^
Main.cpp:20:31: error: 'tail' was not declared in this scope; did you mean 'tanl'?
   20 |         auto it = lower_bound(tail.begin(), tail.end(), -val);
      |                               ^~~~
      |                               tanl
Main.cpp:24:11: error: 'tail' was not declared in this scope; did you mean 'tanl'?
   24 |     cout<<tail.size()<<"\n";
      |           ^~~~
      |           tanl