제출 #1125488

#제출 시각아이디문제언어결과실행 시간메모리
1125488Yang8onAdvertisement 2 (JOI23_ho_t2)C++20
59 / 100
9 ms836 KiB
#include <bits/stdc++.h> #define file "main" #define maxn (int) 5e4 + 5 #define ll long long #define pii pair<int, int> #define gb(i, j) ((i >> j) & 1) #define all(x) x.begin(), x.end() #define fi(i, a, b) for(int i = a; i <= b; i ++) #define fid(i, a, b) for(int i = a; i >= b; i --) #define f first #define s second using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll GetRandom(ll l, ll r) { return uniform_int_distribution<ll> (l, r) (rng); } int n; pii a[maxn]; vector<int> cur; set<int> S; void solve() { cin >> n ; fi(i, 1, n) { int x, y; cin >> x >> y; a[i] = { x - y, x + y }; // cur.push_back(a[i].s), cur.push_back(a[i].f); } // sort( all(cur) ); // cur.resize(unique(all(cur)) - cur.begin()); // // fi(i, 1, n) { // a[i].f = lower_bound(all(cur), a[i].f) - cur.begin() + 1, // a[i].s = lower_bound(all(cur), a[i].s) - cur.begin() + 1; // } sort( a + 1, a + n + 1, [](pii x, pii y) { return x.f == y.f ? x.s > y.s : x.f < y.f; }); int ans = 0; fi(i, 1, n) { if(S.empty() || S.lower_bound(a[i].s) == S.end()) ans ++; S.insert(a[i].s); } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL), cout.tie(NULL); if(fopen(file".inp", "r")) { freopen(file".inp", "r", stdin); // freopen(file".out", "w", stdout); } int nTest = 1; // cin >> nTest; while(nTest --) { solve(); } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |         freopen(file".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...