Submission #447585

#TimeUsernameProblemLanguageResultExecution timeMemory
447585LucaIlieFootball (info1cup20_football)C11
0 / 100
39 ms384 KiB
#include <stdio.h>

int main() {
    int t, n, k, a, max, p2, i;
    long long xor;

    scanf( "%d", &t );
    while ( t-- ) {
        scanf( "%d%d", &n, &k );
        xor = 0;
        max = 0;
        for ( i = 0; i < n; i++ ) {
            scanf( "%d", &a );
            xor += a;
            max = a > max ? a : max;
        }
        p2 = 2;
        while ( p2 <= k && (xor & (p2 - 1)) == 0 )
            p2 *= 2;
        if ( xor % 2 > 0 )
            printf( "1\n" );
        else
            printf( "2\n" );
    }

    return 0;
}

Compilation message (stderr)

football.c: In function 'main':
football.c:7:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf( "%d", &t );
      |     ^~~~~~~~~~~~~~~~~
football.c:9:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf( "%d%d", &n, &k );
      |         ^~~~~~~~~~~~~~~~~~~~~~~
football.c:13:13: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |             scanf( "%d", &a );
      |             ^~~~~~~~~~~~~~~~~
#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...