Submission #946021

#TimeUsernameProblemLanguageResultExecution timeMemory
946021Nika533저울 (IOI15_scales)C++14
0 / 100
1 ms608 KiB
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "scales.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,k;

void init(int T) {
	while(T--) orderCoins();
}

int check(int a, int arr[]) {
	int sz=a-1;
	int x=getNextLightest(arr[sz-3],arr[sz-2],arr[sz-1],a);
	if (x==arr[sz-1]) {
		if (getHeaviest(arr[sz-2],arr[sz-1],a)==a) {
			x=getNextLightest(arr[0],arr[1],arr[2],a);
			if (x==arr[2]) {
				if (getHeaviest(arr[0],arr[1],a)==a) {
					x=-1;
				}
			}
		}
	}
	for (int i=0; i<sz; i++) if (arr[i]==x) x=i;
	return x;
}

void orderCoins() {
   int w[6];
	int a[3];
	int lb;
	a[0]=getLightest(1,2,3);
	a[1]=getMedian(1,2,3);
	a[2]=getHeaviest(1,2,3);
	int x=check(4,a);
	int b[4],ind=0;
	for (int i=0; i<3; i++) {
		if (x<i) {
			b[ind]=4;
			ind++;
		}
		b[ind]=a[i];
		ind++;
	}
	if (x==2) b[3]=4;
	int y=check(5,b);
	int c[5]; ind=0;
	for (int i=0; i<4; i++) {
		if (y<i) {
			c[ind]=5;
			ind++;
		}
		c[ind]=b[i];
		ind++;
	}
	if (y==3) c[4]=5;
	int z=check(6,b);
	ind=0;
	for (int i=0; i<5; i++) {
		if (z<i) {
			w[ind]=6;
			ind++;
		}
		w[ind]=c[i];
		ind++;
	}
	if (z==4) w[5]=6;
	answer(w);
}

Compilation message (stderr)

scales.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:39:6: warning: unused variable 'lb' [-Wunused-variable]
   39 |  int lb;
      |      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...