Submission #946021

# Submission time Handle Problem Language Result Execution time Memory
946021 2024-03-14T09:40:09 Z Nika533 Scales (IOI15_scales) C++14
0 / 100
1 ms 608 KB
#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

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 time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Runtime error 1 ms 348 KB Execution killed with signal 6
3 Runtime error 1 ms 348 KB Execution killed with signal 6
4 Runtime error 1 ms 348 KB Execution killed with signal 6
5 Runtime error 1 ms 440 KB Execution killed with signal 6
6 Runtime error 1 ms 348 KB Execution killed with signal 6
7 Runtime error 1 ms 348 KB Execution killed with signal 6
8 Runtime error 1 ms 348 KB Execution killed with signal 6
9 Runtime error 1 ms 348 KB Execution killed with signal 6
10 Runtime error 1 ms 348 KB Execution killed with signal 6
11 Runtime error 1 ms 348 KB Execution killed with signal 6
12 Runtime error 1 ms 348 KB Execution killed with signal 6
13 Runtime error 1 ms 348 KB Execution killed with signal 6
14 Runtime error 1 ms 348 KB Execution killed with signal 6
15 Runtime error 1 ms 600 KB Execution killed with signal 6
16 Runtime error 1 ms 348 KB Execution killed with signal 6
17 Runtime error 1 ms 348 KB Execution killed with signal 6
18 Runtime error 1 ms 348 KB Execution killed with signal 6
19 Runtime error 1 ms 344 KB Execution killed with signal 6
20 Runtime error 1 ms 348 KB Execution killed with signal 6
21 Runtime error 1 ms 440 KB Execution killed with signal 6
22 Runtime error 1 ms 436 KB Execution killed with signal 6
23 Runtime error 1 ms 352 KB Execution killed with signal 6
24 Runtime error 1 ms 436 KB Execution killed with signal 6
25 Runtime error 1 ms 356 KB Execution killed with signal 6
26 Runtime error 1 ms 608 KB Execution killed with signal 6
27 Runtime error 1 ms 348 KB Execution killed with signal 6
28 Runtime error 1 ms 348 KB Execution killed with signal 6
29 Runtime error 1 ms 352 KB Execution killed with signal 6
30 Runtime error 1 ms 348 KB Execution killed with signal 6
31 Runtime error 1 ms 348 KB Execution killed with signal 6
32 Runtime error 1 ms 348 KB Execution killed with signal 6
33 Runtime error 1 ms 348 KB Execution killed with signal 6
34 Runtime error 1 ms 360 KB Execution killed with signal 6
35 Runtime error 1 ms 348 KB Execution killed with signal 6
36 Runtime error 1 ms 604 KB Execution killed with signal 6
37 Runtime error 0 ms 348 KB Execution killed with signal 6
38 Runtime error 1 ms 360 KB Execution killed with signal 6
39 Runtime error 1 ms 360 KB Execution killed with signal 6
40 Runtime error 1 ms 360 KB Execution killed with signal 6