제출 #412718

#제출 시각아이디문제언어결과실행 시간메모리
412718sadUnscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
2 ms332 KiB
#include<bits/stdc++.h> #include <vector> #define ll long long #define fi first #define se second #define pb push_back #include "messy.h" using namespace std; vector<int>v;int n; int go(string s) { int one=0; for(int i=0;i<n;i++) { if(s[i]=='1'&&one)return 0; if(s[i]=='0')one=1; } return 1; } vector<int> restore_permutation(int N, int w, int r) { n=N; for(int i=0;i<n;i++)v.pb(i); for(int i=0;i<n;i++) { string s; for(int j=0;j<n;j++) { if(j<=i)s+='1'; else s+='0'; } add_element(s); s.clear(); } compile_set(); for(int i=1;i<=256;i++) { string s;int x=i; for(int j=n-1;j>-1;j--) { if((1<<j)&i)s+='1'; else s+='0'; } if(go(s))continue; if(!check_element(s))continue; int w=0,ww=0; for(int j=0;j<n;j++) { if(s[j]=='0'){w=j;break;} } for(int j=n-1;j>-1;j--) { if(s[j]=='1'){ww=j;break;} } swap(v[w],v[ww]);break; } return v; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:37:22: warning: unused variable 'x' [-Wunused-variable]
   37 |         string s;int x=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...