제출 #916662

#제출 시각아이디문제언어결과실행 시간메모리
916662Wansur앵무새 (IOI11_parrots)C++14
52 / 100
2102 ms15508 KiB
#include <bits/stdc++.h> #define f first #define s second #define ent '\n'; using namespace std; typedef long long ll; const int mx=2e5+12; void output(int b); void send(int a); vector<int> g[mx]; int cnt[mx]; int p[mx]; void encode(int n, int a[]){ mt19937 rnd(228); for(int i=0;i<n;i++){ send(a[i]); for(int t=0;t<9;t++){ int x=rnd()%256; send((a[i]^x)); } } }
#include <bits/stdc++.h> #define f first #define s second #define ent '\n'; using namespace std; typedef long long ll; const int mx=2e5+12; void output(int b); void send(int a); vector<int> g[mx]; int cnt[mx]; int p[mx]; void decode(int m, int n, int a[]){ sort(a,a+n); for(int i=0;i<256;i++){ cnt[i]=0; g[i].clear(); } for(int i=0;i<n;i++){ cnt[a[i]]++; } mt19937 rnd(228); for(int i=0;i<m;i++){ p[i]=i; for(int t=0;t<9;t++){ int x=rnd()%256; g[i].push_back(x); } } while(1){ for(int i=0;i<256;i++){ cnt[i]=0; } for(int i=0;i<n;i++){ cnt[a[i]]++; } for(int i=0;i<m;i++){ swap(p[i],p[rnd()%m]); } vector<pair<int,int>> d; for(int i=0;i<n;i++){ vector<int> v=g[p[i]]; for(int x=0;x<=256;x++){ vector<int> t={x}; int mn=--cnt[x]; for(int y:v){ mn=min(mn,--cnt[(x^y)]); t.push_back((x^y)); } if(mn>=0){ d.push_back({p[i],x}); break; } for(int x:t){ cnt[x]++; } } } if(d.size()==m){ sort(d.begin(),d.end()); for(auto x:d){ output(x.s); } return; } } }

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

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:63:14: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   63 |   if(d.size()==m){
      |      ~~~~~~~~^~~
#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...