# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
133858 | Runtime_error_ | Scales (IOI15_scales) | C++14 | 3 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
int larger[8][8],tmp[] = {1,2,3},tmp2[] = {4,5,6};
bool is ; // is == 1 if tmp[0] is larger than tmp2[0]
void init(int T) {
memset(larger,-1,sizeof(larger));
}
void modify(int x,int y){//x<y
larger[x][y] = 0;
larger[y][x] = 1;
}
void modify(int a,int b,int c){//a<b<c
larger[c][b] = larger[c][a] = 1;
larger[b][c] = larger[a][c] = 0;
larger[b][a] = 1 , larger[a][b] = 0;
}
void ask(int x,int y,int z){
int a,b,c;
a = getLightest(x,y,z);
c = getHeaviest(x,y,z);
if( (a == x && c == z) || (c == x && a == z))
b = y;
else if( (a == y && c == z) || (a == z && c == y) )
b = x;
else
b = z;
modify(a,b,c);
}
bool cmp(int x,int y){
return larger[y][x];
}
void loop(int cur){
int x = getNextLightest(1,2,3,cur) , i;
if(!is && x == tmp[0]){
for(int i=0;i<3;i++)
modify(tmp[i],cur);
return ;
}
for(i=0;i<3;i++){
if(tmp[i] == x)
break;
modify(tmp[i],cur);
}
for(;i<3;i++)
modify(cur,tmp[i]);
}
void orderCoins() {
int W [] = {1,2,3,4,5,6};
ask(1,2,3);
ask(4,5,6);
sort(tmp,tmp+3,cmp);
sort(tmp2,tmp2+3,cmp);
int md = getMedian(tmp[0],tmp[2],tmp2[0]);
if(md == tmp[0])
modify(tmp2[0],tmp[0],tmp[2]);
else if(md == tmp[2])
modify(tmp[0],tmp[2],tmp2[0]);
else
modify(tmp[0],tmp2[0],tmp[2]);
is = larger[ tmp[0] ][ tmp2[0] ];
for(int i=4;i<=6;i++)
loop(i);
sort(W,W+6,cmp);
answer(W);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |