제출 #960526

#제출 시각아이디문제언어결과실행 시간메모리
9605268pete8저울 (IOI15_scales)C++17
55.56 / 100
1 ms600 KiB
#include "scales.h" #include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include <cassert> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> //gcd(a,b) #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-loops") using namespace std; void init(int T) { return; }/* void answer(int v[]){ for(int i=0;i<6;i++)cout<<v[i]<<" "; cout<<'\n'; } int arr[7]; int getLightest(int a,int b,int c){ if(a==b||b==c||c==a)assert(0); if(arr[a]<arr[b]&&arr[a]<arr[c])return a; if(arr[b]<arr[a]&&arr[b]<arr[c])return b; return c; } int getHeaviest(int a,int b,int c){ if(a==b||b==c||c==a)assert(0); if(arr[a]>arr[b]&&arr[a]>arr[c])return a; if(arr[b]>arr[a]&&arr[b]>arr[c])return b; return c; }*/ void orderCoins(){ int cnt=0; int x=getLightest(1,2,3),y=getLightest(4,5,6); vector<int>l,r; int curmx=1; int ans[6]; vector<bool>done(7,0),done2(7,0); if(x==curmx)curmx++; int z=getLightest(x,y,curmx); done[z]=1; ans[cnt]=z,cnt++; auto solve=[&](){ vector<int>have; for(int i=1;i<=6;i++)if(!done[i])have.pb(i); int t=getLightest(have[0],have[1],have[2]); curmx=1; for(int i=1;i<=6;i++)if(!done[i]&&i!=t){ curmx=i; break; } t=getLightest(t,curmx,have.back()); ans[cnt]=t,cnt++; done[t]=1; }; if(z==x){ vector<int>ask; for(int i=1;i<=3;i++)if(!done[i])ask.pb(i); ask.pb(y); z=getLightest(ask[0],ask[1],ask[2]); done[z]=1; ans[cnt]=z,cnt++; if(z>=1&&z<=3){ curmx=4; if(curmx==y)curmx++; ask.clear(); for(int i=1;i<=3;i++)if(!done[i])ask.pb(i); ask.pb(y); ask.pb(curmx); z=getLightest(ask[0],ask[1],ask[2]); done[z]=1; ans[cnt]=z,cnt++; } else solve(); } else{ vector<int>ask; for(int i=4;i<=6;i++)if(!done[i])ask.pb(i); ask.pb(x); z=getLightest(ask[0],ask[1],ask[2]); done[z]=1; ans[cnt]=z,cnt++; if(z>=4&&z<=6){ curmx=1; if(curmx==x)curmx++; ask.clear(); for(int i=4;i<=6;i++)if(!done[i])ask.pb(i); ask.pb(x); ask.pb(curmx); z=getLightest(ask[0],ask[1],ask[2]); done[z]=1; ans[cnt]=z,cnt++; } else solve(); } vector<int>have; for(int i=1;i<=6;i++)if(!done[i])have.pb(i); z=getLightest(have[0],have[1],have[2]); done[z]=1; ans[cnt]=z,cnt++; have.clear(); for(int i=1;i<=6;i++)if(!done[i])have.pb(i); for(int i=1;i<=6;i++)if(done[i]){ have.pb(i); break; } z=getHeaviest(have[0],have[1],have[2]); done[z]=1; ans[cnt+1]=z; for(int i=1;i<=6;i++)if(!done[i])ans[cnt]=i; answer(ans); }/* int32_t main(){ int t;cin>>t; while(t--){ vector<pii>cor; for(int i=1;i<=6;i++)cin>>arr[i],cor.pb({arr[i],i}); orderCoins(); sort(all(cor)); for(auto i:cor)cout<<i.s<<" "; cout<<'\n'; } }*/

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

scales.cpp: In function 'void init(int)':
scales.cpp:35:15: warning: unused parameter 'T' [-Wunused-parameter]
   35 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...