제출 #1196801

#제출 시각아이디문제언어결과실행 시간메모리
1196801loomLightning Rod (NOI18_lightningrod)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long inline int readInt() { int x = 0; char ch = getchar(); while (ch < '0' || ch > '9') ch = getchar_unlocked(); while (ch >= '0' && ch <= '9'){ x = (x << 3) + (x << 1) + ch - '0'; ch = getchar_unlocked(); } return x; } int main(){ int n = readInt(); vector<pair<int,int>> a(n); for(int i = 0; i < n; i++) { a[i].first = readInt(); a[i].second = readInt(); if(i > 0 and a[i].first == a[i-1].first) cout<<"haha"; } int ans = n; int mx = -1; vector<int> tf(n, 0); for(int i=0; i<n; i++){ auto [x, y] = a[i]; if(x+y <= mx) ans--, tf[i] = 1; else mx = x+y; } int mn = 1e18; for(int i=n-1; i>=0; i--){ if(tf[i]) continue; auto [x, y] = a[i]; if(x-y >= mn) ans--; else mn = x-y; } cout<<ans; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

cc1plus: error: '::main' must return 'int'