Submission #492470

#TimeUsernameProblemLanguageResultExecution timeMemory
492470vulpesCoins (BOI06_coins)C++17
100 / 100
90 ms4584 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k; scanf("%d%d", &n, &k); vector<int> c(n + 1, k), d(n); for (int i = 0; i < n; i++) { scanf("%d%d", &c[i], &d[i]); } int s = 0, x = 0; for (int i = 0; i < n; i++) { if (!d[i] && c[i] + s < c[i + 1]) { x++; s += c[i]; } } s = max(s, 1); cout << x << endl << k - s << endl; }

Compilation message (stderr)

coins.cpp: In function 'int main()':
coins.cpp:5:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     int n, k; scanf("%d%d", &n, &k);
      |               ~~~~~^~~~~~~~~~~~~~~~
coins.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d%d", &c[i], &d[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...