제출 #133822

#제출 시각아이디문제언어결과실행 시간메모리
133822Runtime_error_저울 (IOI15_scales)C++14
33.33 / 100
2 ms396 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int larger[8][8],tmp[] = {1,2,3},tmp2[] = {4,5,6}; void init(int T) { memset(larger,-1,sizeof(larger)); } void modify(int x,int y){ larger[x][y] = 0; larger[y][x] = 1; } void modify(int a,int b,int 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){ if(!larger[tmp[2]][cur]){ for(int i=0;i<3;i++) modify(tmp[i],cur); return ; } int x = getNextLightest(1,2,3,cur) , i; 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); ask(tmp[2],4,5); ask(tmp[2],5,6); for(int i=4;i<=6;i++) loop(i); sort(W,W+6,cmp); answer(W); }

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

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