Submission #692871

#TimeUsernameProblemLanguageResultExecution timeMemory
692871saayan007Lightning Rod (NOI18_lightningrod)C++17
14 / 100
1754 ms223504 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; using pl = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using vpi = vector<pi>; using vpl = vector<pl>; #define fur(i, a, b) for(ll i = a; i <= (ll) b; ++i) #define ruf(i, a, b) for(ll i = a; i >= (ll) b; --i) #define fr first #define sc second #define mp make_pair #define pb push_back #define eb emplace_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; #define x first #define y second pl a[n + 2]; fur(i, 1, n) { cin >> a[i].x >> a[i].y; } a[0] = a[n + 1] = {0, 0}; sort(a + 1, a + n + 1); ll ans = n; fur(i, 1, n) { if(a[i].y == 0 && (a[i - 1].y == 1 || a[i + 1].y == 1)) --ans; } cout << ans << nl; }
#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...