Submission #1275964

#TimeUsernameProblemLanguageResultExecution timeMemory
1275964SmuggingSpunRasvjeta (COCI17_rasvjeta)C++20
50 / 50
1 ms576 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n, m, k, ans = 0, pre = 1; cin >> n >> m >> k; for(int _ = 0; _ < m; _++){ int x; cin >> x; if(x - k > pre){ ans += (x - k - pre - 1) / (k << 1 | 1) + 1; } pre = x + k + 1; } if(pre <= n){ ans += (n - pre) / (k << 1 | 1) + 1; } cout << ans; }

Compilation message (stderr)

rasjveta.cpp: In function 'int main()':
rasjveta.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...