Submission #946098

#TimeUsernameProblemLanguageResultExecution timeMemory
946098Nika533Scales (IOI15_scales)C++14
0 / 100
1 ms412 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #include "scales.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; int n,m,k; void init(int T) { } int check(int a, int arr[]) { int sz=a-1; int x=getNextLightest(arr[sz-3],arr[sz-2],arr[sz-1],a); // cout<<"XX "<<x<<endl; if (x==arr[sz-1]) { if (getHeaviest(arr[sz-2],arr[sz-1],a)==a) { x=getNextLightest(arr[0],arr[1],arr[2],a); if (x==arr[2]) { if (getHeaviest(arr[0],arr[1],a)==a) { x=-1; } } } } // cout<<"Aa "<<a<<" "<<x<<endl; for (int i=0; i<sz; i++) if (arr[i]==x) x=i; // cout<<"A "<<a<<" "<<x<<endl; return x; } void orderCoins() { int w[6]; int a[3]; int lb; a[2]=getLightest(1,2,3); a[1]=getMedian(1,2,3); a[0]=getHeaviest(1,2,3); int x=check(4,a); int b[4],ind=0; for (int i=0; i<3; i++) { if (x==i-1) { b[ind]=4; ind++; } b[ind]=a[i]; ind++; } if (x==2) b[3]=4; int y=check(5,b); int c[5]; ind=0; for (int i=0; i<4; i++) { if (y<i) { c[ind]=5; ind++; } c[ind]=b[i]; ind++; } if (y==3) c[4]=5; int z=check(6,b); ind=0; for (int i=0; i<5; i++) { if (z<i) { w[ind]=6; ind++; } w[ind]=c[i]; ind++; } if (z==4) w[5]=6; // for (int i=0; i<3; i++) cout<<a[i]<<" "; cout<<endl; // for (int i=0; i<4; i++) cout<<b[i]<<" "; cout<<endl; // for (int i=0; i<5; i++) cout<<c[i]<<" "; cout<<endl; reverse(w,w+6); answer(w); }

Compilation message (stderr)

scales.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
scales.cpp: In function 'void init(int)':
scales.cpp:15:15: warning: unused parameter 'T' [-Wunused-parameter]
   15 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:41:6: warning: unused variable 'lb' [-Wunused-variable]
   41 |  int lb;
      |      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...