Submission #258585

#TimeUsernameProblemLanguageResultExecution timeMemory
258585errorgornDevil's Share (RMI19_devil)C++14
14 / 100
78 ms2168 KiB
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(186608); //this is cursed

int n,k;
int arr[10]; //dont change this

int ans[100005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int TC;
	cin>>TC;
	while (TC--){
		cin>>k;
		n=0;
		rep(x,1,10){
			cin>>arr[x];
			n+=arr[x];
		}
		
		int l=1,r=9;
		
		rep(x,0,n){
			if (x%2==0){
				while (arr[r]==0) r--;
				ans[x]=r;
				arr[r]--;
			}
			else{
				while (arr[l]==0) l++;
				ans[x]=l;
				arr[l]--;
			}
		}
		
		rep(x,n,0) cout<<ans[x]; cout<<endl;
	}
}

Compilation message (stderr)

devil.cpp: In function 'int main()':
devil.cpp:19:26: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
                          ^
devil.cpp:69:3: note: in expansion of macro 'rep'
   rep(x,n,0) cout<<ans[x]; cout<<endl;
   ^~~
devil.cpp:69:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   rep(x,n,0) cout<<ans[x]; cout<<endl;
                            ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...