Submission #587133

#TimeUsernameProblemLanguageResultExecution timeMemory
587133wdjpng자동 인형 (IOI18_doll)C++17
0 / 100
611 ms11912 KiB
#include <bits/stdc++.h> #include "doll.h" #define int long long #define all(a) a.begin(), a.end() #define rep(i,n) for(int i = 0; i<n; i++) using namespace std; vector<signed>x,y; int pow2=1; int cs = 0, ct = 1; map<int,pair<int,int>>ind; int build(int l, int r, vector<signed>&a) { if(r<=pow2-a.size()) return -1; if(l+1==r) return ct++; cs++; int ccs = -cs; ind[ccs].first = build(l,(l+r)/2,a); ind[ccs].second = build((l+r)/2,r,a); return ccs; } int cntr = 0; map<int,bool>flip; int sim(int cs, vector<signed>&a) { if(cs>0) return a[cntr++]; flip[cs]=!flip[cs]; if(flip[cs]) x[-cs-1]=sim(ind[cs].first,a); else y[-cs-1]=sim(ind[cs].second,a); return cs; } void create_circuit(signed m, vector<signed> a) { signed n = a.size(); vector<signed>c(m+1); c[0]=a[0]; a.push_back(0); a.erase(a.begin(), a.begin()+1); while (pow2<a.size()) pow2*=2; rep(i,m) c[i+1]=-1; build(0,pow2,a); x.assign(cs,1e9); y.assign(cs,1e9); rep(i,m) sim(-1,a); answer(c,x,y); }

Compilation message (stderr)

doll.cpp: In function 'long long int build(long long int, long long int, std::vector<int>&)':
doll.cpp:16:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   16 |   if(r<=pow2-a.size()) return -1;
      |      ~^~~~~~~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:45:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   while (pow2<a.size()) pow2*=2;
      |          ~~~~^~~~~~~~~
doll.cpp:38:10: warning: unused variable 'n' [-Wunused-variable]
   38 |   signed n = a.size();
      |          ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...