Submission #1012744

#TimeUsernameProblemLanguageResultExecution timeMemory
1012744kachim2Football (info1cup20_football)C++17
100 / 100
29 ms2140 KiB
#include<bits/stdc++.h>
using namespace std;
bool sol(){
    int n;
    int k, kk = 1;
    cin >> n;
    cin >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int acc = accumulate(a.begin(), a.end(), 0);

    while(acc!=0 && kk <=k){
    if(acc&1) return 1;
    for(int &i : a) i/=2; kk*=2;
    acc = accumulate(a.begin(), a.end(), 0);
    }
    return 0;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    int t;
    cin >> t;

    for(int i = 0; i < t; i++){
        cout << ((sol()) ? "1" : "0") ;//<< '\n';
    }
}

Compilation message (stderr)

football.cpp: In function 'bool sol()':
football.cpp:14:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   14 |     for(int &i : a) i/=2; kk*=2;
      |     ^~~
football.cpp:14:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |     for(int &i : a) i/=2; kk*=2;
      |                           ^~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...