#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
template<class T>
void readi(T &x)
{
T input = 0;
bool negative = false;
char c = ' ';
while (c < '-')
{
c = getchar();
}
if (c == '-')
{
negative = true;
c = getchar();
}
while (c >= '0')
{
input = input * 10 + (c - '0');
c = getchar();
}
if (negative)
{
input = -input;
}
x = input;
}
template<class T>
void printi(T output)
{
if (output == 0)
{
putchar('0');
return;
}
if (output < 0)
{
putchar('-');
output = -output;
}
int aout[20];
int ilen = 0;
while(output)
{
aout[ilen] = ((output % 10));
output /= 10;
ilen++;
}
for (int i = ilen - 1; i >= 0; i--)
{
putchar(aout[i] + '0');
}
return;
}
template<class T>
void ckmin(T &a, T b)
{
a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
a = max(a, b);
}
long long randomize(long long mod)
{
return ((1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-20;
#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
long long normalize(long long x, long long mod = INF)
{
return (((x % mod) + mod) % mod);
}
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//bad stuff
//#define _MAXN 6
//#define _MAX_ANSWER_CALLS 1
//
//static int _realC[_MAXN];
//static int _ind[_MAXN];
//static int _numQueries;
//static int _numAnswerCalls;
//static FILE * _f;
//static FILE * _of;
//
//static void _initNewTest() {
// int i, ret;
//
// for (i = 0; i < _MAXN; i++) {
// ret = fscanf(_f, "%d", &_realC[i]);
// assert(ret == 1);
// _realC[i]--;
// _ind[_realC[i]] = i;
// }
//
// _numQueries = 0;
// _numAnswerCalls = 0;
//}
//
//void answer(int W[]) {
// for (int i = 0; i < 6; i++)
// {
// cout << W[i] << ' ';
// }
// cout << endl;
//}
//
//static void _checkQuery(int A, int B, int C, int D) {
// if (D == -1) {
// if (A < 1 || A > 6 || B < 1 || B > 6 || C < 1 || C > 6)
// assert(0);
// if (A == B || B == C || A == C)
// assert(0);
// }
// else {
// if (A < 1 || A > 6 || B < 1 || B > 6 || C < 1 || C > 6 || D < 1 || D > 6)
// assert(0);
// if (A == B || A == C || A == D || B == C || B == D || C == D)
// assert(0);
// }
//}
//
//int getMedian(int A, int B, int C) {
// _numQueries++;
// _checkQuery(A, B, C, -1);
//
// A--; B--; C--;
//
// if (_ind[B] < _ind[A] && _ind[A] < _ind[C])
// return A + 1;
//
// if (_ind[C] < _ind[A] && _ind[A] < _ind[B])
// return A + 1;
//
// if (_ind[A] < _ind[B] && _ind[B] < _ind[C])
// return B + 1;
//
// if (_ind[C] < _ind[B] && _ind[B] < _ind[A])
// return B + 1;
//
// return C + 1;
//}
//
//int getHeaviest(int A, int B, int C) {
// _numQueries++;
// _checkQuery(A, B, C, -1);
//
// A--; B--; C--;
//
// if (_ind[A] > _ind[B] && _ind[A] > _ind[C])
// return A + 1;
//
// if (_ind[B] > _ind[A] && _ind[B] > _ind[C])
// return B + 1;
//
// return C + 1;
//}
//
//int getLightest(int A, int B, int C) {
// _numQueries++;
// _checkQuery(A, B, C, -1);
//
// A--; B--; C--;
//
// if (_ind[A] < _ind[B] && _ind[A] < _ind[C])
// return A + 1;
//
// if (_ind[B] < _ind[A] && _ind[B] < _ind[C])
// return B + 1;
//
// return C + 1;
//}
//
//int getNextLightest(int A, int B, int C, int D) {
// int allLess = 1;
//
// _numQueries++;
// _checkQuery(A, B, C, D);
//
// A--; B--; C--; D--;
//
// if (_ind[A] > _ind[D] || _ind[B] > _ind[D] || _ind[C] > _ind[D])
// allLess = 0;
//
// if (allLess == 1) {
// if (_ind[A] < _ind[B] && _ind[A] < _ind[C])
// return A + 1;
//
// if (_ind[B] < _ind[A] && _ind[B] < _ind[C])
// return B + 1;
//
// return C + 1;
// }
//
// if (_ind[A] > _ind[D]) {
// if ((_ind[A] < _ind[B] || _ind[B] < _ind[D]) && (_ind[A] < _ind[C] || _ind[C] < _ind[D]))
// return A + 1;
// }
//
// if (_ind[B] > _ind[D]) {
// if ((_ind[B] < _ind[A] || _ind[A] < _ind[D]) && (_ind[B] < _ind[C] || _ind[C] < _ind[D]))
// return B + 1;
// }
//
// return C + 1;
//}
//end bad stuff
int ans[6], pos[6];
void init(int T)
{
/* ... */
}
void orderCoins()
{
for (int i = 0; i < 6; i++)
{
ans[i] = i + 1;
}
for (int i = 1; i < 6; i++)
{
bool swap = false;
for (int j = 0; j < 4; j++)
{
int lo = getLightest(ans[j], ans[j + 1], ans[j + 2]);
int hi = getHeaviest(ans[j], ans[j + 1], ans[j + 2]);
int mid;
if (lo != ans[j] || hi != ans[j + 2]) swap = true;
if (ans[j] != lo && ans[j] != hi) mid = ans[j];
if (ans[j + 1] != lo && ans[j + 1] != hi) mid = ans[j + 1];
if (ans[j + 2] != lo && ans[j + 2] != hi) mid = ans[j + 2];
ans[j] = lo;
ans[j + 1] = mid;
ans[j + 2] = hi;
}
if (!swap)
{
break;
}
}
for (int i = 0; i < 6; i++)
{
ans[i]--;
pos[ans[i]] = i + 1;
}
answer(pos);
}
//int main()
//{
// for (int i = 0; i < 6; i++)
// {
// cin >> _ind[i];
// }
// orderCoins();
//
//}
Compilation message
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:241:15: warning: unused parameter 'T' [-Wunused-parameter]
void init(int T)
^
scales.cpp: In function 'void orderCoins()':
scales.cpp:265:15: warning: 'mid' may be used uninitialized in this function [-Wmaybe-uninitialized]
ans[j + 1] = mid;
~~~~~~~~~~~^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
548 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
612 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
612 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
612 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
620 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
620 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
620 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
648 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
648 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
648 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
648 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
672 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
680 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
680 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
680 KB |
Output isn't correct |
18 |
Incorrect |
3 ms |
680 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
688 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
688 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
688 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
688 KB |
Output isn't correct |
23 |
Incorrect |
4 ms |
688 KB |
Output isn't correct |
24 |
Incorrect |
4 ms |
688 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
704 KB |
Output isn't correct |
26 |
Incorrect |
3 ms |
708 KB |
Output isn't correct |
27 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
28 |
Incorrect |
3 ms |
708 KB |
Output isn't correct |
29 |
Incorrect |
3 ms |
708 KB |
Output isn't correct |
30 |
Incorrect |
3 ms |
708 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
708 KB |
Output isn't correct |
32 |
Incorrect |
4 ms |
708 KB |
Output isn't correct |
33 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
34 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
35 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
36 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
37 |
Incorrect |
2 ms |
708 KB |
Output isn't correct |
38 |
Incorrect |
3 ms |
752 KB |
Output isn't correct |
39 |
Incorrect |
2 ms |
752 KB |
Output isn't correct |
40 |
Incorrect |
3 ms |
752 KB |
Output isn't correct |