Submission #1239891

#TimeUsernameProblemLanguageResultExecution timeMemory
1239891JerBikeparking (EGOI24_bikeparking)C++20
16 / 100
1095 ms2628 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5; int users[MAXN], slots[MAXN]; int n; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &slots[i]); for (int i = 0; i < n; i++) scanf("%d", &users[i]); int res = 0; for (int i = 0; i < n; i++) { for (int curr = 0; curr < i; curr++) { if (slots[curr] > users[i]) res += users[i], slots[curr] -= users[i], users[i] = 0; else res += slots[curr], users[i] -= slots[curr], slots[curr] = 0; } } for (int i = 0; i < n; i++) { if (slots[i] <= users[i]) users[i] -= slots[i], slots[i] = 0; else slots[i] -= users[i], users[i] = 0; } for (int i = 0; i < n; i++) res -= users[i]; printf("%d\n", res); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%d", &slots[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d", &users[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
#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...