제출 #1019514

#제출 시각아이디문제언어결과실행 시간메모리
1019514NoLoveSails (IOI07_sails)C++14
5 / 100
1077 ms2016 KiB
/** * author : Lăng Trọng Đạt * created: 11-07-2024 **/ #include <bits/stdc++.h> using namespace std; #ifndef LANG_DAT #define db(...) ; #endif // LANG_DAT #define int long long #define mp make_pair #define f first #define se second #define pb push_back #define all(v) (v).begin(), (v).end() using pii = pair<int, int>; using vi = vector<int>; #define FOR(i, a, b) for (int (i) = a; (i) <= (b); i++) void mx(int& a, int b) { if (b > a) a = b; } void mi(int& a, int b) { if (b < a) a = b; } #define si(x) (int)(x.size()) const int INF = 1e18; const int MOD = 1e9 + 7; const int MAXN = 1e5 + 5; int g[MAXN], h[MAXN], k[MAXN], cnt[MAXN], id[MAXN]; int n; int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("hi.inp", "r")) { freopen("hi.inp", "r", stdin); // freopen("hi.out", "w", stdout); } cin >> n; FOR(i, 1, 1e5) id[i] = i; int ans = 0; FOR(i, 1, n) { cin >> h[i] >> k[i]; sort(id + 1, id + h[i] + 1, [](int i, int j) { if (cnt[i] == cnt[j]) return i > j; return cnt[i] < cnt[j]; }); db(h[i], k[i]) FOR(j, 1, k[i]) { db(j, id[j], cnt[id[j]]) ans += cnt[id[j]]; cnt[id[j]]++; } } cout << ans; }

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

sails.cpp: In function 'int32_t main()':
sails.cpp:18:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   18 | #define FOR(i, a, b) for (int (i) = a; (i) <= (b); i++)
      |                               ^
sails.cpp:37:5: note: in expansion of macro 'FOR'
   37 |     FOR(i, 1, 1e5) id[i] = i;
      |     ^~~
sails.cpp:18:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   18 | #define FOR(i, a, b) for (int (i) = a; (i) <= (b); i++)
      |                               ^
sails.cpp:39:5: note: in expansion of macro 'FOR'
   39 |     FOR(i, 1, n) {
      |     ^~~
sails.cpp:18:31: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   18 | #define FOR(i, a, b) for (int (i) = a; (i) <= (b); i++)
      |                               ^
sails.cpp:46:9: note: in expansion of macro 'FOR'
   46 |         FOR(j, 1, k[i]) {
      |         ^~~
sails.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen("hi.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...
#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...