제출 #782844

#제출 시각아이디문제언어결과실행 시간메모리
782844ymm저울 (IOI15_scales)C++17
55.56 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x) typedef std::pair<int,int> pii; typedef long long ll; using namespace std; void init(int T) { /* ... */ } void lstmx(int &a, int &b, int &c) { int x = getHeaviest(a, b, c); if (a == x) swap(a, c); if (b == x) swap(b, c); } void fstmn(int &a, int &b, int &c) { int x = getLightest(a, b, c); if (c == x) swap(a, c); if (b == x) swap(a, b); } void mv(int W[], int i, int j) { int x = W[i]; memmove(W+i, W+i+1, (5-i)*4); memmove(W+j+1, W+j, (5-j)*4); W[j] = x; } void orderCoins() { /* ... */ int W[] = {1, 2, 3, 4, 5, 6}; fstmn(W[0], W[1], W[2]); fstmn(W[3], W[4], W[5]); int x = getNextLightest(W[0], W[1], W[2], W[3]); int y = getNextLightest(W[3], W[4], W[5], W[0]); if (x == W[0] && y == W[3]) { lstmx(W[0], W[1], W[2]); lstmx(W[3], W[4], W[5]); if (getLightest(W[0], W[3], W[4]) != W[0]) { swap(W[0], W[3]); swap(W[1], W[4]); swap(W[2], W[5]); } answer(W); return; } cerr << "Hi\n"; if (y != W[3]) { swap(x, y); swap(W[0], W[3]); swap(W[1], W[4]); swap(W[2], W[5]); } lstmx(W[0], W[1], W[2]); int a[3] = {x}; Loop (j,1,3) a[j] = getNextLightest(W[0], W[1], W[2], W[3+j]); Loop (i,0,3) { if (a[i] == W[0]) { a[i] = 3; continue; } Loop (j,1,3) { if (a[i] == W[j]) { a[i] = j; break; } } } //Loop (i,0,6) // cerr << W[i] << ' '; //cerr << '\n'; //Loop (i,0,3) // cerr << a[i] << ' '; //cerr << '\n'; if (a[1] == a[2]) lstmx(W[3], W[4], W[5]); if (a[1] > a[2]) { swap(a[1], a[2]); swap(W[4], W[5]); } mv(W, 5, a[2]); mv(W, 5, a[1]); mv(W, 5, a[0]); answer(W); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:9:15: warning: unused parameter 'T' [-Wunused-parameter]
    9 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:74:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   74 |     a[i] = j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...