Submission #136866

# Submission time Handle Problem Language Result Execution time Memory
136866 2019-07-26T12:05:38 Z AyaBenSaad Scales (IOI15_scales) C++14
0 / 100
3 ms 508 KB
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;

void init(int T) {
}

int ans[7];
int a[5], b[5];

void orderCoins() {
  a[1] = getLightest (1, 2, 3); 
  b[1] = getLightest (4, 5, 6);

  a[2] = getMedian (1, 2, 3); 
  b[2] = getMedian (4, 5, 6);

  a[3] = 1+2+3-a[1]-a[2];
  b[3] = 4+5+6-b[1]-b[2];

  ans[0] = getLightest(a[1], b[1], b[2]);
  int l = 1, r = 1;
  if (ans[0] == a[1]) l++;
  if (ans[0] == b[1]) r++;

  ans[1] = getLightest(a[l], b[r], b[3]);
  if (ans[1] == a[l]) l++;
  if (ans[1] == b[r]) r++;

  ans[2] = getLightest(a[l], b[r], (r > 3 ? a[3] : b[3]));
  if (ans[2] == a[l]) l++;
  if (ans[2] == b[r]) r++;

  if (l > 3) ans[3] = getLightest(b[1], b[2], b[3]);
  else if (r > 3) ans[3] = getLightest (a[1], a[2], a[3]);
  else ans[3] = getLightest(a[l], b[r], (r > 3 ? a[3] : b[3]));
  if (ans[3] == a[l]) l++;
  if (ans[3] == b[r]) r++;

  if(l > 3) ans[4] = getMedian(ans[0], b[2], b[3]);
  else if(r > 3) ans[4] = getMedian(ans[0], a[2], a[3]);
  else ans[4] = getMedian(ans[0], a[3], b[3]);

  ans[5] = (6*7)/2 - (ans[0]+ans[1]+ans[2]+ans[3]+ans[4]);
    answer(ans);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)