Submission #722850

#TimeUsernameProblemLanguageResultExecution timeMemory
722850vjudge1Timovi (COCI18_timovi)C++17
20 / 80
1096 ms10184 KiB
#include <bits/stdc++.h> #define B begin() #define E end() #define F first #define S second #define pb push_back #define pf push_front #define eb emplace_back #define ll long long #define ui unsigned int #define ull unsigned long long #define sts stable_sort using namespace std; const int MAXN = 1e6 + 4; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, c, cnt; cin >> n >> c >> cnt; if(n == 1){ cout << cnt << "\n"; return 0; } unordered_map<ll, ll> m; bool a = 1; for(ll i = 0; i <= n; ){ if(cnt >= c){ m[i] += c; cnt -= c; }else{ m[i] += cnt; cnt = 0; } if(cnt == 0)break; if(n >= 3){ if(i == 2){ a = 0; }else if(i == 0 && !a){ a = 1; } }else{ if(i == 1){ a = 0; }else if( i == 0 & !a){ a = 1; } } if(a)i++; else i--; } for(int i = 0; i < n; i++){ cout << m[i] << " "; } cout << "\n"; return 0; }

Compilation message (stderr)

timovi.cpp: In function 'int main()':
timovi.cpp:48:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   48 |             }else if( i == 0 & !a){
      |                       ~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...