Submission #146985

#TimeUsernameProblemLanguageResultExecution timeMemory
146985dongwon0427Lightning Rod (NOI18_lightningrod)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; int n; static char buf[1 << 19]; // size : any number geq than 1024 static int idx = 0; static int bytes = 0; static inline int _read() { if (!bytes || idx == bytes) { bytes = (int)fread(buf, sizeof(buf[0]), sizeof(buf), stdin); idx = 0; } return buf[idx++]; } static inline int fastscan() { int x = 0, s = 1; int c = _read(); while (c <= 32) c = _read(); if (c == '-') s = -1, c = _read(); while (c > 32) x = 10 * x + (c - '0'), c = _read(); if (s < 0) x = -x; return x; } vector<pii> v; int main() { fastscan(n); pii prv = pii(-1,0); for(int i=0;i<n;i++) { int t1,t2; fastscan(t1); fastscan(t2); if(t1 != prv.first) { prv = pii(t1,t2); v.push_back(prv); } else if(prv.second < t2) { prv.second = t2; v.back().second = t2; } } vector<int> s; s.push_back(0); int mx = v[0].first + v[0].second; for(int i=1;i<v.size();i++) { pii p = v[i]; if(mx >= p.first + p.second) continue; mx = p.first + p.second; while(!s.empty()) { pii t = v[s.back()]; if(t.second - t.first <= p.second - p.first) s.pop_back(); else break; } s.push_back(i); //for(int x : s) cout<<x<<' '; //cout<<'\n'; } cout<<s.size(); return 0; }

Compilation message (stderr)

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:32:15: error: too many arguments to function 'int fastscan()'
     fastscan(n);
               ^
lightningrod.cpp:20:19: note: declared here
 static inline int fastscan() {
                   ^~~~~~~~
lightningrod.cpp:36:20: error: too many arguments to function 'int fastscan()'
         fastscan(t1); fastscan(t2);
                    ^
lightningrod.cpp:20:19: note: declared here
 static inline int fastscan() {
                   ^~~~~~~~
lightningrod.cpp:36:34: error: too many arguments to function 'int fastscan()'
         fastscan(t1); fastscan(t2);
                                  ^
lightningrod.cpp:20:19: note: declared here
 static inline int fastscan() {
                   ^~~~~~~~
lightningrod.cpp:49:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<v.size();i++) {
                 ~^~~~~~~~~