Submission #783787

#TimeUsernameProblemLanguageResultExecution timeMemory
783787LyricallyScales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int read(){int x;scanf("%lld",&x);return x;}
void print(int x){printf("%lld\n",x);}
void file(string s)
{
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}
const int mod=998244353;
void init(int T){}
//getLightest,getHeaviest,getMedian,getNextLightest
void orderCoins()
{
	int ans[6];bool fl[7]={0};
	int a=getLightest(1,2,3),b=getLightest(4,5,6);
	set<int> v;rep1(i,6){v.insert(i);}
	rep1(i,6)
	{
		if(i!=a&&i!=b)
		{
			int c=getLightest(a,b,i);
			ans[0]=c;fl[c]=1;v.erase(c);break;
		}
	}
	vector<int> p;
	for(auto x:v){p.pb(x);}
	int d=getLightest(p[0],p[1],p[2]),e=getLightest(d,p[3],p[4]);
	ans[1]=e;
	v.erase(e);
	p.clear();for(auto x:v){p.pb(x);}
	int f=getLightest(p[0],p[1],p[2]);
	int id=-1;
	rep(i,3){if(f!=p[i]){id=i;break;}}
	int g=getLightest(f,p[id],p[3]);
	ans[2]=g;v.erase(g);
	p.clear();for(auto x:v){p.pb(x);}
	int h=getLightest(p[0],p[1],p[2]);
	ans[3]=h;
	int k=getMedian(p[0],p[1],p[2]);
	ans[4]=k;
	rep(i,3)
	{
		if(p[i]!=h&&p[i]!=k){ans[5]=p[i];break;}
	}
	answer(ans);
}

Compilation message (stderr)

scales.cpp: In function 'void init(long long int)':
scales.cpp:16:15: warning: unused parameter 'T' [-Wunused-parameter]
   16 | void init(int T){}
      |               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:21:8: error: 'getLightest' was not declared in this scope
   21 |  int a=getLightest(1,2,3),b=getLightest(4,5,6);
      |        ^~~~~~~~~~~
scales.cpp:25:15: error: 'b' was not declared in this scope
   25 |   if(i!=a&&i!=b)
      |               ^
scales.cpp:34:9: error: 'e' was not declared in this scope
   34 |  ans[1]=e;
      |         ^
scales.cpp:45:8: error: 'getMedian' was not declared in this scope
   45 |  int k=getMedian(p[0],p[1],p[2]);
      |        ^~~~~~~~~
scales.cpp:51:2: error: 'answer' was not declared in this scope
   51 |  answer(ans);
      |  ^~~~~~
scales.cpp:33:6: warning: unused variable 'd' [-Wunused-variable]
   33 |  int d=getLightest(p[0],p[1],p[2]),e=getLightest(d,p[3],p[4]);
      |      ^
scales.cpp: In function 'long long int read()':
scales.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | int read(){int x;scanf("%lld",&x);return x;}
      |                  ~~~~~^~~~~~~~~~~
scales.cpp: In function 'void file(std::string)':
scales.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen((s+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scales.cpp:13:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  freopen((s+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~