Submission #49790

# Submission time Handle Problem Language Result Execution time Memory
49790 2018-06-03T06:46:15 Z zetapi Scales (IOI15_scales) C++14
0 / 100
4 ms 1196 KB
#include "scales.h"
#include "bits/stdc++.h"

using namespace std;

#define mp make_pair
#define pb push_back

void init(int T)
{
    /* ... */

}

void erase(int X,vector<int> &f,vector<int> &s)
{
	for(int A=0;A<f.size();A++)
		if(f[A]==X)
		{
			f.erase(f.begin()+A);
			return ;
		}
	for(int A=0;A<s.size();A++)
		if(s[A]==X)
		{
			s.erase(s.begin()+A);
			return ;
		}
	return ;
}

void orderCoins() 
{
    /* ... */
    int W[] = {1, 2, 3, 4, 5, 6};
    vector<int> f(3),s(3),res;
    f={getLightest(1,2,3),getMedian(1,2,3),6-(f[0]+f[1])};
    s={getLightest(4,5,6),getMedian(4,5,6),15-(s[0]+s[1])};
    while((!f.empty())||(!s.empty()))
    {
    	if(f.empty())
    	{
    		while(!s.empty())
    		{
    			res.pb(*s.begin());
    			s.erase(s.begin());
    		}
    	}
    	else if(s.empty())
    	{
    		while(!f.empty())
    		{
    			res.pb(*f.begin());
    			f.erase(f.begin());
    		}
    	}
    	else if(f.size()==1 && s.size()==1)
    	{
    		res.pb(getMedian(res[0],f[0],s[0]));
    		res.pb(f[0]+s[0]-res.back());
    		erase(res[res.size()-2],f,s);
    		erase(res[res.size()-1],f,s);
    	}
    	else
    	{
    		if(res.empty())
    		{
    			res.pb(getLightest(f[0],f[1],s[0]));
    			erase(res.back(),f,s);
    		}
    		else
    		{
    			res.pb(getMedian(res[0],f[0],s[0]));
    			erase(res.back(),f,s);
    		}
    	}
    }
    for(int A=0;A<6;A++)
    	W[A]=res[A]; 
    answer(W);
}

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:9:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T)
               ^
scales.cpp: In function 'void erase(int, std::vector<int>&, std::vector<int>&)':
scales.cpp:17:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<f.size();A++)
              ~^~~~~~~~~
scales.cpp:23:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<s.size();A++)
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 648 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 816 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 3 ms 960 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 2 ms 976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 3 ms 992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 1004 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 2 ms 1012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Incorrect 2 ms 1024 KB Output isn't correct
15 Runtime error 3 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 2 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 1028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 1028 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 2 ms 1036 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 4 ms 1052 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 1052 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 2 ms 1060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 2 ms 1060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 2 ms 1068 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 1068 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 3 ms 1076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 3 ms 1080 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 4 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Incorrect 2 ms 1196 KB Output isn't correct
32 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Incorrect 3 ms 1196 KB Output isn't correct
34 Runtime error 4 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 4 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 3 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 4 ms 1196 KB Execution killed with signal 11 (could be triggered by violating memory limits)