#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) {
}
int check(int a, int arr[]) {
int sz=a-1;
int x=getNextLightest(arr[sz-3],arr[sz-2],arr[sz-1],a);
// cout<<"XX "<<x<<endl;
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;
}
}
}
}
// cout<<"Aa "<<a<<" "<<x<<endl;
for (int i=0; i<sz; i++) if (arr[i]==x) x=i;
// cout<<"A "<<a<<" "<<x<<endl;
return x;
}
void orderCoins() {
int w[6];
int a[3];
int lb;
a[2]=getLightest(1,2,3);
a[1]=getMedian(1,2,3);
a[0]=getHeaviest(1,2,3);
int x=check(4,a);
int b[4],ind=0;
for (int i=0; i<3; i++) {
if (x==i-1) {
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-1) {
c[ind]=5;
ind++;
}
c[ind]=b[i];
ind++;
}
if (y==3) c[4]=5;
int z=check(6,c);
ind=0;
for (int i=0; i<5; i++) {
if (z==i-1) {
w[ind]=6;
ind++;
}
w[ind]=c[i];
ind++;
}
if (z==4) w[5]=6;
reverse(w,w+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 init(int)':
scales.cpp:15:15: warning: unused parameter 'T' [-Wunused-parameter]
15 | void init(int T) {
| ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:41:6: warning: unused variable 'lb' [-Wunused-variable]
41 | int lb;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
360 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
26 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
28 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
30 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
33 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
38 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
40 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |