Submission #783790

#TimeUsernameProblemLanguageResultExecution timeMemory
783790LyricallyScales (IOI15_scales)C++17
45.45 / 100
1 ms256 KiB
#include<bits/stdc++.h> #include "scales.h" using namespace std; #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("%d",&x);return x;} void print(int x){printf("%d\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(int)':
scales.cpp:16:15: warning: unused parameter 'T' [-Wunused-parameter]
   16 | void init(int T){}
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:20:18: warning: variable 'fl' set but not used [-Wunused-but-set-variable]
   20 |  int ans[6];bool fl[7]={0};
      |                  ^~
scales.cpp: In function '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("%d",&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);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...