(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #306224

#TimeUsernameProblemLanguageResultExecution timeMemory
306224biggCoins (IOI17_coins)C++14
100 / 100
13 ms1736 KiB
#include "coins.h" #include<bits/stdc++.h> using namespace std; std::vector<int> coin_flips(std::vector<int> b, int c) { int bitsom[8]; memset(bitsom, 0, sizeof(bitsom)); std::vector<int> flips(1); int cnt = 0; for(int i = 0; i < 64; i++){ if(!b[i]) continue; for(int j = 5; j >= 0; j--){ if(i&(1<<j))bitsom[j]++; } } for(int i = 0; i < 6; i++){ // printf("%d\n", bitsom[i]); bitsom[i]%=2; } int cur = 0; for(int i = 0; i < 6; i++){ if(!bitsom[i]) continue; cur |= 1<<i; } // printf("%d\n",cur ); flips[0] = cur^c; return flips; } int find_coin(std::vector<int> b) { int bitsom[8]; memset(bitsom, 0, sizeof(bitsom)); for(int i = 0; i < 64; i++){ // /printf("%d", b[i]); // if(i%8 == 7)printf("\n"); if(!b[i]) continue; for(int j = 5; j >= 0; j--){ if(i&(1<<j))bitsom[j]++; } } for(int i = 0; i < 6; i++){ // printf("%d\n",bitsom[i] ); bitsom[i]%=2; } int cur = 0; for(int i = 0; i < 6; i++){ if(!bitsom[i]) continue; cur |= 1<<i; } return cur; } // vector<int> b; // int main(){ // int atual = 0; // int c; // scanf("%d", &c); // for(int i = 0; i < 64; i++){ // char q; // scanf(" %c", &q); // b.push_back(q - '0'); // } // int mov = coin_flips(b,c)[0]; // b[mov] = 1-b[mov]; // printf("%d\n",find_coin(b) ); // }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:9:9: warning: unused variable 'cnt' [-Wunused-variable]
    9 |     int cnt = 0;
      |         ^~~
#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...