Submission #60801

#TimeUsernameProblemLanguageResultExecution timeMemory
60801Flugan42Scales (IOI15_scales)C++14
45.45 / 100
4 ms684 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> ii; typedef vector<ii> vii; typedef long double lld; #define rep(i,a,b) for(ll i = a; i < b; i++) #define per(i,a,b) for(ll i = a; i >= b; i--) #define all(x) x.begin(),x.end() #define sz(x) (ll)(x).size() #define trav(a,x) for(auto a : x) #define inf 1000000000000000000 void init(int T) { } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; int A[3],B[3]; A[0] = getLightest(1,2,3); A[1] = getMedian(1,2,3); A[2] = 6-A[0]-A[1]; B[0] = getLightest(4,5,6); B[1] = getMedian(4,5,6); B[2] = 15-B[0]-B[1]; ll a[3]; rep(i,0,3) a[i] = getNextLightest(A[0],A[1],A[2],B[i]); if (a[0] == A[0] && a[1] == A[0] && a[2] == A[0]){ if (getLightest(A[0],A[1],B[1]) == B[1]){ W[0] = B[0]; W[1] = B[1]; if (getLightest(A[0],A[1],B[2]) == B[2]){ W[2] = B[2]; W[3] = A[0]; W[4] = A[1]; W[5] = A[2]; } else { W[2] = A[0]; W[3] = A[1]; W[4] = A[2]; W[5] = B[2]; } } else { W[4] = B[1]; W[5] = B[2]; if (getLightest(A[0],A[1],B[0]) == B[0]){ W[0] = B[0]; W[1] = A[0]; W[2] = A[1]; W[3] = A[2]; } else { W[0] = A[0]; W[1] = A[1]; W[2] = A[2]; W[3] = B[0]; } } } else { vector<vi> befA; vi _; befA.assign(4,_); bool check = true; rep(i,0,3){ rep(j,0,3){ if (a[i] == A[j]){ if (j == 0 && check){ befA[j].push_back(B[i]); } else if (j == 0) { befA[3].push_back(B[i]); } else { befA[j].push_back(B[i]); check = false; } } } } ll cur = 0; rep(i,0,4){ trav(j,befA[i]){ W[cur] = j; cur++; } if (i < 3) { W[cur] = A[i]; cur++; } } } answer(W); }

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:16:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:83:20: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
           W[cur] = j; cur++;
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...