제출 #1244821

#제출 시각아이디문제언어결과실행 시간메모리
1244821CrabCNHUnija (COCI17_unija)C++20
100 / 100
210 ms6976 KiB
#include <bits/stdc++.h> #define pii pair <int, int> #define fi first #define se second using namespace std; const int N = 1e7 + 5; const int inf = 1e18 + 7; int mp[N]; signed main () { ios_base :: sync_with_stdio (0); cin.tie (0); cout.tie (0); #define task "crab" if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } int n; cin >> n; for (int i = 1; i <= n; i ++) { int x, y; cin >> x >> y; mp[x / 2] = max (mp[x / 2], y / 2); } int cur = 0; long long ans = 0; for (int i = 1e7; i >= 1; i --) { cur = max (cur, mp[i]); ans += cur; } cout << ans * 4; }

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

unija.cpp:10:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   10 | const int inf = 1e18 + 7;
      |                 ~~~~~^~~
unija.cpp: In function 'int main()':
unija.cpp:20:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
unija.cpp:21:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...