Submission #733824

#TimeUsernameProblemLanguageResultExecution timeMemory
733824vjudge1Lightning Rod (NOI18_lightningrod)C++17
0 / 100
2065 ms131856 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ll t, n, m, ans, i, z,j, x, y; cin >> n; vector < pair < ll, ll > > v; ans = 0; for ( i = 1; i <= n; i ++) { cin >> x >> y; v.push_back(make_pair(y, x)); } map < ll, ll > A; sort ( v.begin(), v.end()); for ( i = v.size() - 1; i >= 0; i -- ) { if ( A[i] == 0) { A[i] = 1; ans ++; for ( j = i; j >= 0; j --) { if ( abs(v[i].second - v[j].second) >= abs(v[i].first - v[j].first)) { A[j] = 1; } } } } cout << ans << endl; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:6:5: warning: unused variable 't' [-Wunused-variable]
    6 |  ll t, n, m, ans, i, z,j, x, y;
      |     ^
lightningrod.cpp:6:11: warning: unused variable 'm' [-Wunused-variable]
    6 |  ll t, n, m, ans, i, z,j, x, y;
      |           ^
lightningrod.cpp:6:22: warning: unused variable 'z' [-Wunused-variable]
    6 |  ll t, n, m, ans, i, z,j, x, y;
      |                      ^
#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...