제출 #1022577

#제출 시각아이디문제언어결과실행 시간메모리
1022577jamjanekUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
2 ms604 KiB
//Rozwiazanie pelne k = m = n*log(n) #include <bits/stdc++.h> #include "messy.h" using namespace std; string pop[2]; int liczby[200]; void dodaj1(string s){ add_element(s); // cout<<"D:"<<s<<'\n'; } bool zapytaj1(string s){ bool czy = check_element(s); // cout<<"Z:"<<s<<':'<<czy<<"\n"; return czy; } vector<int> restore_permutation(int n, int m, int k){ int i, w, j; for(i=0;i<n;i++)pop[0]+='0'; for(i=0;i<n;i++)pop[1]+='0'; if(n==128)w=7; if(n==32)w=5; if(n==8)w=3; for(i=0;i<w;i++){ for(j=0;j<n;j++){ if((j>>i)&1){ auto &pom = pop[!((j>>(i-1))&1)]; pom[j] = '1'; dodaj1(pom); pom[j] = '0'; } } for(j=0;j<n;j++){ pop[0][j] = pop[1][j] = '0'; if((j>>i)&1)pop[1][j] = '1'; else pop[0][j] = '1'; } } compile_set(); for(i=0;i<w;i++){ for(j=0;j<n;j++){ string pom; bool czy = (liczby[j]>>(i-1))&1; for(int ij=0;ij<n;ij++)pom+='0'+((liczby[ij]>>(i-1))&1)^czy; pom[j]='1'; liczby[j]+=(1<<i)*zapytaj1(pom); } } vector<int>p; for(i=0;i<n;i++)p.push_back(liczby[i]); return(p); }

컴파일 시 표준 에러 (stderr) 메시지

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:46:39: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   46 |        for(int ij=0;ij<n;ij++)pom+='0'+((liczby[ij]>>(i-1))&1)^czy;
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...