제출 #278858

#제출 시각아이디문제언어결과실행 시간메모리
278858tinjyuUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
5 ms1024 KiB
#include <vector> #include "messy.h" #include <iostream> using namespace std; int ans[100005],tag[100005],N; void add(int s,int e) { if(s==e)return ; int mid=(s+e)/2; string str=""; for(int i=0;i<N;i++)str+='0'; for(int i=0;i<s;i++)str[i]='1'; for(int i=e+1;i<N;i++)str[i]='1'; for(int i=s;i<=mid;i++) { str[i]='1'; add_element(str); str[i]='0'; } add(s,mid); add(mid+1,e); } int find(int s,int e) { //cout<<s<<" "<<e<<endl; if(s==e) { for(int i=0;i<N;i++) { if(tag[i]==0)ans[i]=s; } return 0; } string str=""; for(int i=0;i<N;i++)str+='0'; for(int i=0;i<N;i++)if(tag[i]==1)str[i]='1'; int tmp[1005]; for(int i=0;i<N;i++)tmp[i]=0; for(int i=0;i<N;i++) { if(tag[i]==0) { str[i]='1'; //cout<<str<<" "; bool c=check_element(str); //cout<<c<<endl; if(c==1)tmp[i]=1; else tmp[i]=2; str[i]='0'; } } for(int i=0;i<N;i++) { if(tmp[i]==0 || tmp[i]==2)tag[i]=1; else tag[i]=0; } find(s,(s+e)/2); for(int i=0;i<N;i++) { if(tmp[i]==0 || tmp[i]==1)tag[i]=1; else tag[i]=0; } find((s+e)/2+1,e); } std::vector<int> restore_permutation(int n, int w, int r) { N=n; add(0,n-1); compile_set(); find(0,n-1); vector<int>a(n); for(int i=0;i<n;i++) { a[i]=ans[i]; } return a; }

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

messy.cpp: In function 'int find(int, int)':
messy.cpp:36:13: warning: control reaches end of non-void function [-Wreturn-type]
   36 |  string str="";
      |             ^~
#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...