Submission #733822

#TimeUsernameProblemLanguageResultExecution timeMemory
733822vjudge1Lightning Rod (NOI18_lightningrod)C++17
0 / 100
1601 ms262144 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int t, n, m, ans, i, z,j, x, y; cin >> n; vector < pair < ll, ll > > v; ans = 0; for ( i = 1; i <= n; i ++) { scanf("%d %d",&x, &y); v.push_back(make_pair(y, x)); } map < int, int > 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:6: warning: unused variable 't' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, y;
      |      ^
lightningrod.cpp:6:12: warning: unused variable 'm' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, y;
      |            ^
lightningrod.cpp:6:23: warning: unused variable 'z' [-Wunused-variable]
    6 |  int t, n, m, ans, i, z,j, x, y;
      |                       ^
lightningrod.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d %d",&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...