# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
960526 | 8pete8 | 저울 (IOI15_scales) | C++17 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |