Submission #1314670

#TimeUsernameProblemLanguageResultExecution timeMemory
1314670joshjuiceLightning Rod (NOI18_lightningrod)C++20
100 / 100
270 ms159156 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define fi first #define se second #define p push inline void input(ll & x) { x = 0; char ch = getchar_unlocked(); while (ch < '0' || ch > '9') ch = getchar_unlocked(); while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch & 15); ch = getchar_unlocked(); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; input(n); stack<pll> s; for (ll i = 0; i < n; ++i) { pll c; input(c.fi); input(c.se); bool b = 1; while (s.size()) { ll tx = s.top().fi, ty = s.top().se; ll x = c.fi, y = c.se; if (abs(tx-x) <= ty-y) { //tx protect b = 0; break; } else if (abs(x-tx) <= y-ty) s.pop(); // x protect else break; // individual } if (b) s.p(c); } printf("%lld", s.size()); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:37:20: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'std::stack<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wformat=]
   37 |         printf("%lld", s.size());
      |                 ~~~^   ~~~~~~~~
      |                    |         |
      |                    |         std::stack<std::pair<long long int, long long int> >::size_type {aka long unsigned int}
      |                    long long int
      |                 %ld
#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...