Submission #1248603

#TimeUsernameProblemLanguageResultExecution timeMemory
1248603camdovipSnail (NOI18_snail)C++20
0 / 100
1095 ms320 KiB
#include<bits/stdc++.h> #define ll long long #define fi first #define se second #define pairll pair<ll,ll> using namespace std; const int N = 1e5 + 5, mod = 1e9 + 7, base = 256; ll h, n; ll x[N]; void solve() { cin >> h >> n; for (int i = 1; i <= n; i ++) { cin >> x[i]; } ll up = 0; for (int i = 1; i <= n; i ++) { up += x[i]; } if (up < 0) { cout << -1 << " " << -1; } ll day = 0, hour = 0; while (h >= up) { day ++; h -= up; } cout << max (day - 1, 0LL) << " "; for (int i = 1; i <= n; i ++) { if (h >= 0) { h -= x[i]; hour ++; } else break; } cout << (hour - 1 + n) % n; } int main() { freopen ("SNAIL.INP", "r", stdin); freopen ("SNAIL.OUT", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); ll testcase = 1; // cin >> testcase; while (testcase --) solve(); } //road to national prize

Compilation message (stderr)

snail.cpp: In function 'int main()':
snail.cpp:38:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         freopen ("SNAIL.INP", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
snail.cpp:39:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         freopen ("SNAIL.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...