제출 #419241

#제출 시각아이디문제언어결과실행 시간메모리
419241mat_vUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
2 ms808 KiB
#include <bits/stdc++.h> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define pb push_back #include "messy.h" using namespace std; int N; void dodaj(int l, int r){ if(l == r)return; ff(i,0,(r-l+1)/2 - 1){ string x=""; ff(j,0,N - 1){ if(j < l || j > r)x += '1'; else{ if(j == i+l)x += '1'; else x += '0'; } } add_element(x); } int mid = (l + r) / 2; dodaj(l,mid); dodaj(mid + 1, r); } int slika[1005]; bool ima[1005]; void resi(int l, int r, vector<int> s){ if(l == r){ slika[l] = s[0]; return; } vector<int> gde; ff(i,0,N-1)ima[i] = 0; for(auto c:s)ima[c] = 1; vector<int> pola; ff(i,0,(r-l+1)/2 - 1){ string x = ""; int kol = 0; ff(j,0,N-1){ if(!ima[j])x += '1'; else{ if(kol == i)x += '1'; else x += '0'; kol++; } } //check(x); if(check_element(x))pola.pb(s[i]); } vector<int> druga; ff(i,0,N-1)ima[i] = 0; for(auto c:pola)ima[c] = 0; for(auto c:s)if(!ima[c])druga.pb(c); int mid = (l + r) / 2; resi(l,mid,pola); resi(mid + 1,r,druga); } std::vector<int> restore_permutation(int n, int w, int r) { N = n; dodaj(0,n - 1); compile_set(); vector<int> v; ff(i,0,n-1)v.pb(i); resi(0,n-1,v); vector<int> ans; ff(i,0,N-1)ans.pb(slika[i]); return ans; }

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

messy.cpp: In function 'void dodaj(int, int)':
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:14:5: note: in expansion of macro 'ff'
   14 |     ff(i,0,(r-l+1)/2 - 1){
      |     ^~
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:16:9: note: in expansion of macro 'ff'
   16 |         ff(j,0,N - 1){
      |         ^~
messy.cpp: In function 'void resi(int, int, std::vector<int>)':
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:40:5: note: in expansion of macro 'ff'
   40 |     ff(i,0,N-1)ima[i] = 0;
      |     ^~
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:43:5: note: in expansion of macro 'ff'
   43 |     ff(i,0,(r-l+1)/2 - 1){
      |     ^~
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:46:9: note: in expansion of macro 'ff'
   46 |         ff(j,0,N-1){
      |         ^~
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:58:5: note: in expansion of macro 'ff'
   58 |     ff(i,0,N-1)ima[i] = 0;
      |     ^~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:71:5: note: in expansion of macro 'ff'
   71 |     ff(i,0,n-1)v.pb(i);
      |     ^~
messy.cpp:4:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    4 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
messy.cpp:75:5: note: in expansion of macro 'ff'
   75 |     ff(i,0,N-1)ans.pb(slika[i]);
      |     ^~
#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...