QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#362196#8509. Expanding STACKS!ucup-team087#AC ✓3ms4252kbC++2015.7kb2024-03-23 14:31:392024-03-23 14:31:41

Judging History

你现在查看的是最新测评结果

  • [2024-03-23 14:31:41]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:4252kb
  • [2024-03-23 14:31:39]
  • 提交

answer

#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#endif

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
//#define int ll

bool dbg=false;

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

ll rand_int(ll l, ll r) { //[l, r]
	//#ifdef LOCAL
	static mt19937_64 gen;
	/*#else
	static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
	#endif*/
	return uniform_int_distribution<ll>(l, r)(gen);
}

ll rand_int(ll k){ //[0,k)
	return rand_int(0,k-1);
}
string rand_string(int n,char lw,char up){
	string s(n,'?');
	rep(i,n)s[i]=rand_int(lw,up);
	return s;
}

int current_run_id,run_batch_size=1000;
int calc_random_limit(){
	return current_run_id/run_batch_size+1;
}
template<class t>
void generate_single(t&a){
	a=rand_int(1,calc_random_limit());
}
void generate_single(string&a){
	int n;generate_single(n);
	a=rand_string(n,'a','b');
}
template<class t,class u>
void generate_single(pair<t,u>&a){
	generate_single(a.a);
	generate_single(a.b);
}
//https://trap.jp/post/1224/
template<class... Args>
void input(Args&... a){
	if(dbg){
		(generate_single(a),...);
	}else{
		(cin >> ... >> a);
	}
}
#define INT(...) int __VA_ARGS__;input(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;input(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;input(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;input(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;input(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;input(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;input(__VA_ARGS__)
#define overload3(a,b,c,d,...) d
#define VI2(name,size) vi name(size);rep(i,size)input(name[i]);
#define VI3(name,size,offset) vi name(size);rep(i,size)input(name[i]),name[i]+=offset;
#define VI(...) overload3(__VA_ARGS__,VI3,VI2)(__VA_ARGS__)
#define VPI(name,size) vc<pi> name(size);rep(i,size)input(name[i]);

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

pi readpi(int off=0){
	int a,b;cin>>a>>b;
	return pi(a+off,b+off);
}

template<class t>
void print_single(t x,int suc=1){
	cout<<x;
	if(suc==1){
		if(dbg)cout<<endl;
		else cout<<"\n";
	}
	if(suc==2)
		cout<<" ";
}

template<class t,class u>
void print_single(const pair<t,u>&p,int suc=1){
	print_single(p.a,2);
	print_single(p.b,suc);
}

template<class T>
void print_single(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print_single(v[i],i==int(v.size())-1?suc:2);
}

template<class T>
void print_offset(const vector<T>&v,ll off,int suc=1){
	rep(i,v.size())
		print_single(v[i]+off,i==int(v.size())-1?suc:2);
}

template<class T,size_t N>
void print_single(const array<T,N>&v,int suc=1){
	rep(i,N)
		print_single(v[i],i==int(N)-1?suc:2);
}

template<class T>
void print(const T&t){
	print_single(t);
}

template<class T,class ...Args>
void print(const T&t,const Args&...args){
	print_single(t,2);
	print(args...);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

void YES(bool ex=true){
	cout<<"YES\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void NO(bool ex=true){
	cout<<"NO\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void Yes(bool ex=true){
	cout<<"Yes\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void No(bool ex=true){
	cout<<"No\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
//#define CAPITAL
/*
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}*/
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int topbit(ull t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int botbit(ull a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
int popcount(ull t){
	return __builtin_popcountll(t);
}
int bitparity(ll t){
	return __builtin_parityll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
ll mask(int i){
	return (ll(1)<<i)-1;
}
ull umask(int i){
	return (ull(1)<<i)-1;
}
ll minp2(ll n){
	if(n<=1)return 1;
	else return ll(1)<<(topbit(n-1)+1);
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class S> void mkuni(S&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

template<class t> bool isuni(vc<t> v){
	int s=si(v);
	mkuni(v);
	return si(v)==s;
}

template<class t>
void myshuffle(vc<t>&a){
	rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}

template<class S,class u>
int lwb(const S&v,const u&a){
	return lower_bound(all(v),a)-v.bg;
}
template<class t,class u>
bool bis(const vc<t>&v,const u&a){
	return binary_search(all(v),a);
}

//VERIFY: yosupo
//KUPC2017J
//AOJDSL1A
//without rank
struct unionfind{
	vi p,s;
	int c;
	unionfind(int n):p(n,-1),s(n,1),c(n){}
	void clear(){
		fill(all(p),-1);
		fill(all(s),1);
		c=si(p);
	}
	int find(int a){
		return p[a]==-1?a:(p[a]=find(p[a]));
	}
	//set b to a child of a
	bool unite(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b)return false;
		p[b]=a;
		s[a]+=s[b];
		c--;
		return true;
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	int sz(int a){
		return s[find(a)];
	}
};

vvc<int> readGraph(int n,int m){
	vvc<int> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		//sc.read(a,b);
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	return g;
}

vvc<int> readTree(int n){
	if(dbg){
		vvc<int> t(n);
		unionfind uf(n);
		while(uf.c>1){
			int a=rand_int(n);
			int b=rand_int(n);
			if(uf.unite(a,b)){
				t[a].pb(b);
				t[b].pb(a);
			}
		}
		return t;
	}else{
		return readGraph(n,n-1);
	}
}

void printTree(const vvc<int> t){
	int n=si(t);
	int degsum=0;
	rep(i,n)degsum+=si(t[i]);
	if(degsum==n-1){
		//directed
		rep(i,si(t))for(auto j:t[i]){
			print(i+1,j+1);
		}
	}else if(degsum==2*(n-1)){
		//undirected
		rep(i,si(t))for(auto j:t[i])if(i<j){
			print(i+1,j+1);
		}
	}else{
		assert(false);
	}
}

template<class t>
vc<t> presum(const vc<t>&a){
	vc<t> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
vc<ll> presum(const vi&a){
	vc<ll> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
//BIT で数列を管理するときに使う (CF850C)
template<class t>
vc<t> predif(vc<t> a){
	gnr(i,1,si(a))a[i]-=a[i-1];
	return a;
}
template<class t>
vvc<ll> imos(const vvc<t>&a){
	int n=si(a),m=si(a[0]);
	vvc<ll> b(n+1,vc<ll>(m+1));
	rep(i,n)rep(j,m)
		b[i+1][j+1]=b[i+1][j]+b[i][j+1]-b[i][j]+a[i][j];
	return b;
}

//verify してないや
void transvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void transvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[j][i]=a[i][j];
	}
	a.swap(b);
	transvvc(n,m,args...);
}
//CF854E
void rotvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void rotvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[m-1-j][i]=a[i][j];
	}
	a.swap(b);
	rotvvc(n,m,args...);
}

//ソートして i 番目が idx[i]
//CF850C
template<class t>
vi sortidx(const vc<t>&a){
	int n=si(a);
	vi idx(n);iota(all(idx),0);
	sort(all(idx),[&](int i,int j){return a[i]<a[j];});
	return idx;
}
//vs[i]=a[idx[i]]
//例えば sortidx で得た idx を使えば単にソート列になって返ってくる
//CF850C
template<class t>
vc<t> a_idx(const vc<t>&a,const vi&idx){
	int n=si(a);
	assert(si(idx)==n);
	vc<t> vs(n);
	rep(i,n)vs[i]=a[idx[i]];
	return vs;
}
//CF850C
vi invperm(const vi&p){
	int n=si(p);
	vi q(n);
	rep(i,n)q[p[i]]=i;
	return q;
}

template<class t,class s=t>
s SUM(const vc<t>&a){
	return accumulate(all(a),s(0));
}
template<class t,size_t K,class s=t>
s SUM(const array<t,K>&a){
	return accumulate(all(a),s(0));
}

template<class t>
t MAX(const vc<t>&a){
	return *max_element(all(a));
}

template<class t>
pair<t,int> MAXi(const vc<t>&a){
	auto itr=max_element(all(a));
	return mp(*itr,itr-a.bg);
}

template<class A>
auto MIN(const A&a){
	return *min_element(all(a));
}

template<class t>
pair<t,int> MINi(const vc<t>&a){
	auto itr=min_element(all(a));
	return mp(*itr,itr-a.bg);
}

vi vid(int n){
	vi res(n);iota(all(res),0);
	return res;
}

template<class S>
void soin(S&s){
	sort(all(s));
}

template<class S,class F>
void soin(S&s,F&&f){
	sort(all(s),forward<F>(f));
}

template<class S>
S soout(S s){
	soin(s);
	return s;
}

template<class S>
void rein(S&s){
	reverse(all(s));
}

template<class S>
S reout(S s){
	rein(s);
	return s;
}

template<class t,class u>
pair<t,u>&operator+=(pair<t,u>&a,pair<t,u> b){
	a.a+=b.a;a.b+=b.b;return a;}
template<class t,class u>
pair<t,u>&operator-=(pair<t,u>&a,pair<t,u> b){
	a.a-=b.a;a.b-=b.b;return a;}
template<class t,class u>
pair<t,u> operator+(pair<t,u> a,pair<t,u> b){return mp(a.a+b.a,a.b+b.b);}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a,pair<t,u> b){return mp(a.a-b.a,a.b-b.b);}
template<class t,class u,class v>
pair<t,u>&operator*=(pair<t,u>&a,v b){
	a.a*=b;a.b*=b;return a;}
template<class t,class u,class v>
pair<t,u> operator*(pair<t,u> a,v b){return a*=b;}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a){return mp(-a.a,-a.b);}
namespace std{
template<class t,class u>
istream&operator>>(istream&is,pair<t,u>&a){
	return is>>a.a>>a.b;
}
}

template<class t>
t gpp(vc<t>&vs){
	assert(si(vs));
	t res=move(vs.back());
	vs.pop_back();
	return res;
}

template<class t,class u>
void pb(vc<t>&a,const vc<u>&b){
	a.insert(a.ed,all(b));
}

template<class t,class...Args>
vc<t> cat(vc<t> a,Args&&...b){
	(pb(a,forward<Args>(b)),...);
	return a;
}

template<class t,class u>
vc<t>& operator+=(vc<t>&a,u x){
	for(auto&v:a)v+=x;
	return a;
}

template<class t,class u>
vc<t> operator+(vc<t> a,u x){
	return a+=x;
}

template<class t>
vc<t> operator+(const vc<t>&a,const vc<t>&b){
	vc<t> c(max(si(a),si(b)));
	rep(i,si(a))c[i]+=a[i];
	rep(i,si(b))c[i]+=b[i];
	return c;
}

template<class t,class u>
vc<t>& operator-=(vc<t>&a,u x){
	for(auto&v:a)v-=x;
	return a;
}
template<class t,class u>
vc<t>& operator-(vc<t> a,u x){
	return a-=x;
}

template<class t,class u>
vc<t>& operator*=(vc<t>&a,u x){
	for(auto&v:a)v*=x;
	return a;
}
template<class t,class u>
vc<t>& operator*(vc<t> a,u x){
	return a*=x;
}

template<class t,class u>
void remval(vc<t>&a,const u&v){
	a.erase(remove(all(a),v),a.ed);
}
//消した要素の個数を返してくれる
//UCUP 2-8-F
template<class t,class F>
int remif(vc<t>&a,F f){
	auto itr=remove_if(all(a),f);
	int res=a.ed-itr;
	a.erase(itr,a.ed);
	return res;
}

template<class VS,class u>
void fila(VS&vs,const u&a){
	fill(all(vs),a);
}

template<class t,class u>
int findid(const vc<t>&vs,const u&a){
	auto itr=find(all(vs),a);
	if(itr==vs.ed)return -1;
	else return itr-vs.bg;
}

template<class t>
void rtt(vc<t>&vs,int i){
	rotate(vs.bg,vs.bg+i,vs.ed);
}

//Multiuni2023-8 C
//f(lw)=false,...,f(n-1)=false,f(n)=true,...,f(up)=true,
//のときに n を返す
template<class F>
int find_min_true(int lw,int up,F f){
	while(up-lw>1){
		const int mid=(lw+up)/2;
		if(f(mid))up=mid;
		else lw=mid;
	}
	return up;
}
//f(lw)=true,f(up)=false
template<class F>
int find_max_true(int lw,int up,F f){
	while(up-lw>1){
		const int mid=(lw+up)/2;
		if(f(mid))lw=mid;
		else up=mid;
	}
	return lw;
}

template<class t> using pqmin=priority_queue<t,vc<t>,greater<t>>;
template<class t> using pqmax=priority_queue<t>;
using T=tuple<int,int,int>;

//CCPC Finals 2021 H (二部のケースだけ)
template<class E>
pair<bool,vi> bipartite_partition(const vvc<E>&g){
	int n=si(g);
	bool ok=true;
	vi res(n,-1);
	auto dfs=[&](auto self,int v,int d)->void{
		if(res[v]!=-1){
			if(res[v]!=d)ok=false;
			return;
		}
		res[v]=d;
		for(auto to:g[v])self(self,to,d^1);
	};
	rep(i,n)if(res[i]==-1)dfs(dfs,i,0);
	if(ok)return mp(true,res);
	else return mp(false,vi{});
}

void slv(){
	INT(n);
	vi in(n),out(n);
	rep(i,2*n){
		STR(s);
		char c=s[0];
		int v=stoi(s.substr(1))-1;
		if(c=='+')in[v]=i;
		else out[v]=i;
	}
	auto cross=[&](int i,int j){
		rep(_,2){
			if(in[i]<in[j]&&in[j]<out[i]&&out[i]<out[j])
				return true;
			swap(i,j);
		}
		return false;
	};
	vvc<int> g(n);
	rep(i,n)rng(j,i+1,n){
		if(cross(i,j)){
			g[i].pb(j);
			g[j].pb(i);
		}
	}
	auto [can,par]=bipartite_partition(g);
	if(can){
		string ans;
		for(auto v:par)ans+=("GS"[v]);
		print(ans);
	}else{
		print('*');
	}
}

signed main(signed argc,char*argv[]){
	if(argc>1&&strcmp(argv[1],"D")==0)dbg=true;
	
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	if(dbg){
		while(1){
			if(current_run_id%run_batch_size==0){
				cerr<<"Current Run "<<current_run_id<<endl;
			}
			slv();
			current_run_id++;
		}
	}else{
		//int t;cin>>t;rep(_,t)
		slv();
	}
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

input:

2
+2 +1 -1 -2

output:

GG

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2
+1 +2 -1 -2

output:

GS

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

3
+1 +2 +3 -1 -2 -3

output:

*

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

10
+3 -3 +4 -4 +6 +2 -2 -6 +7 -7 +5 -5 +10 +1 +9 +8 -8 -9 -1 -10

output:

GGGGGGGGGG

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

10
+8 -8 +2 +10 -2 -10 +7 -7 +1 -1 +6 -6 +5 +3 +4 +9 -9 -4 -3 -5

output:

GGGGGGGGGS

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

42
+26 -26 +12 +8 -12 -8 +30 +5 +22 +3 -3 +2 -30 +10 -10 -2 -22 +23 +39 -39 +17 -17 -23 +38 +24 -24 +27 +29 -29 -27 -38 -5 +37 -37 +21 +16 +28 -28 +6 +40 +14 +19 -19 -14 +11 +35 -35 -11 +4 +25 -25 -4 -40 -6 +13 +20 +1 -1 +33 +34 +7 -7 -34 +41 -41 +36 +31 -31 -36 +42 +32 -32 +15 +18 -18 -15 +9 -9 -42...

output:

GGGGGGGGGGGSGGGGGGGGGGGGGGGGGSGGGGGGGGGGGG

result:

ok correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

42
+40 +18 +42 +2 +1 +21 +33 -2 +8 -33 -8 +14 -40 +34 +30 +31 -31 -30 +5 -5 +4 -34 +13 +3 -13 -3 -4 +28 -28 +17 -17 +35 +10 -10 +16 +39 +36 +37 -37 -36 -39 +25 +6 +41 -41 +20 +12 +32 -32 -25 -12 -16 -35 +38 -20 -38 -14 +15 -15 +9 +26 +23 -21 -1 +7 -23 +22 +24 -7 -24 -42 -18 -22 -26 -9 -6 +27 +29 -29...

output:

GSGGGSGSSGGSSGGGGGGSGSSSGSGGGGGGGSGGGGGSGG

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

42
+29 +6 +7 +2 -7 -2 +23 -23 -6 -29 +19 -19 +16 +8 -16 -8 +32 -32 +3 +37 +17 -17 -37 -3 +22 -22 +18 +1 +40 +36 -1 -36 -40 -18 +9 -9 +30 +25 -25 +14 +39 +5 +20 -5 +12 -39 +28 +10 -14 +24 -24 +35 +15 -15 +41 -30 +33 -33 -41 -35 -10 -28 -12 +21 +38 -38 -21 +11 +13 -13 +4 +42 +27 +34 -34 +31 -31 +26 -2...

output:

GGGGGGSGGSGSGGGSGGGSGGGGGGGSGGGGGGSSGGGSSG

result:

ok correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

100
+39 -39 +4 +71 -71 +53 -53 +46 -46 -4 +91 -91 +97 -97 +6 -6 +54 -54 +76 +35 -35 +50 +89 -89 +98 -50 -76 -98 +34 +55 +95 -34 +36 -36 +73 -95 -55 +18 +47 +20 +30 +33 -30 -33 +80 -73 +51 -51 -80 -20 +69 +77 -69 +85 +62 +84 -84 -77 +48 +49 -49 +1 -1 -48 +19 -19 -62 -85 +41 +16 -16 -41 +63 +2 -2 +65 ...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGSGGGGGGGGGGGGGGGGGGGGSGG

result:

ok correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

100
+5 -5 +61 +48 +60 +69 +7 -7 -69 -60 +45 -45 -48 -61 +68 +4 +82 +57 -57 +12 -12 +22 +46 -46 -22 +14 +30 -30 +47 -47 -14 +94 -94 -82 +44 +27 -27 -44 +86 -86 -4 +50 +15 -15 -50 -68 +58 -58 +28 +83 -83 -28 +53 +1 +56 -56 +67 +13 +73 +87 +19 +65 +18 -18 +17 -17 +89 +62 -62 -89 +72 -72 +25 -25 -65 +98...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

result:

ok correct

Test #11:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

100
+96 +64 -64 +41 +11 +62 +18 +25 +3 +26 -26 -3 +22 +61 +59 +73 -59 -73 -61 -62 +20 -41 -20 +46 -46 -22 +2 +10 -10 -2 -25 -18 +9 -9 -11 +60 +33 +97 +38 -38 +5 -5 -97 +81 +29 -29 -81 +92 +1 +52 -52 +87 +19 -19 +90 -90 -87 -1 -92 -33 -60 -96 +47 +6 +72 -72 +79 +98 +45 -45 +23 -23 -98 +35 -35 +27 -27...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGG

result:

ok correct

Test #12:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

171
+118 +125 +156 +76 +123 +61 +107 +15 +160 -15 -107 -160 +98 +127 -127 +152 -61 -123 +48 +139 +86 -86 +43 +129 +164 +167 +6 +9 +137 +20 +16 -20 -16 +11 +12 +133 +24 -24 -137 -133 +81 +71 +88 +142 -142 +105 -88 +93 +33 -33 -105 +85 +64 -64 +150 +5 -150 +121 -85 +1 -121 +41 -5 +53 +67 +3 -3 +72 +10...

output:

GGGGSSGGSGGGGGGGSSGSSGGGSGGGGGGGGGSSSSSSGGGGGGSSGSGGGGSGSGSGGGGGGGGGGGGGGSGGSGGGGSGGGGGSSGGGSSGGSSSSGGSGGGGSGGGGGGGGSGSGSGGGSGGGGGGGGGGSSGSGSGGGSGGGGGGSSGGSGSSSGGGGGGSGSGG

result:

ok correct

Test #13:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

171
+47 -47 +50 -50 +108 +130 +146 -146 +76 +87 -87 -76 -108 -130 +158 -158 +161 -161 +133 -133 +63 +132 +144 -132 +61 +21 +109 -61 -109 -21 -144 +104 -63 +69 -69 +123 +110 -123 -104 +94 +20 +55 -55 -20 -94 -110 +64 +119 +103 +12 -103 +139 -139 +28 +72 +165 -72 +90 +67 +9 +107 +166 -166 -67 -90 -165...

output:

GGGGGGGGSGGSGGGGGGGGGGGGGGGSGGGGGGGGGSGGGGGGGGGSGGGGGGGGGGGGSGGSGSGGGGGSGGGGGGSGGGGGSGGSGGGGSGGGGGGGGGGSGGSGGGGGGSSGGSGGSGSGGGSGGSGGGGGGGGGGGGGSSGGSGGGGSSGGGGGGGGGGGGGGGGS

result:

ok correct

Test #14:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

171
+148 -148 +41 -41 +7 +113 -7 +28 +100 +92 -28 -92 -100 +46 -46 -113 +149 +67 +68 -68 +88 +150 +157 -157 -150 +161 +133 +171 -171 +103 -103 -133 +60 -60 +44 +4 -4 -44 +75 -75 -161 +116 -116 -88 -67 -149 +170 +160 +124 -124 +101 +163 +129 +78 -78 -129 -163 +43 -43 -101 -160 +71 -71 -170 +166 -166 ...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGSGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

result:

ok correct

Test #15:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

666
+486 -486 +361 +23 +422 +664 +601 -601 -664 +85 +516 -85 +561 -561 +462 -516 -422 -462 +618 -618 -23 -361 +630 +189 +63 +520 -63 -189 +435 +172 -172 +535 +282 +44 -44 -282 -535 -520 -435 -630 +637 -637 +346 +336 -346 +624 +200 -200 +125 -125 -624 +187 +382 -187 +355 -336 +365 -365 +521 -521 -355...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGSSGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGSGGGGGGSSGGGGGGGGSGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

result:

ok correct

Test #16:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

666
+596 +130 +656 +93 -130 +308 +537 +485 -308 +89 -89 +144 +40 -40 -485 +30 +510 +559 -559 +646 -510 +191 -191 +644 -644 +7 +553 +409 -646 -30 -537 +331 -409 -331 -553 -7 -596 +187 -187 -144 +517 +528 -517 -528 -93 -656 +420 +391 +61 -61 -391 +259 -259 -420 +282 +45 -45 +299 -299 -282 +625 +469 -4...

output:

GGGGGGGGGGGSGGGGGGGGSGSGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGSGGGGGGGGGGSGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGSGGSGGGGSGGGGGGGGGGGGGGSGGGGGG...

result:

ok correct

Test #17:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

666
+477 +406 -477 -406 +396 -396 +59 -59 +145 -145 +190 +426 +384 -426 +236 -236 +590 -384 +520 +132 -132 -520 -590 +218 +429 +382 -382 +664 -218 -664 +61 -61 -429 -190 +591 -591 +385 -385 +241 -241 +186 +294 -294 -186 +333 +13 -13 -333 +587 +465 -465 +275 -275 -587 +362 +123 +640 +305 +151 +350 -3...

output:

GGGGGGGSGSGGGSGGGGSGSGGGGGGGGGGGSGSGGGGGGGSGGGGGGGGSGGGGSGGGGGGSGGGGGGSGGGGGGGSSGSGGGGGGGGSGGGGGGGSGGSGGSGGGGGGGGGGSGGGGSGGGGGGGGGGGGSGGSGGGGGSGGGSGGGSGGGGSGGGGSSGSGGGGGGSGGGGSGGGGGGSGGGGGGGSGSGGGGGGGSGGGGGGGGGGSGSGGGGGSSGGGGGGGSGGSGGGGGGGGGGGGGGSGGGGGSGGGGGGGGGGSSGGSGGGGSGGGGGGGGGSGGSGSGGGGGGGGGSSS...

result:

ok correct

Test #18:

score: 0
Accepted
time: 2ms
memory: 3912kb

input:

1000
+478 -478 +298 +39 -39 +715 -298 +753 -753 -715 +718 -718 +547 +955 -547 -955 +787 -787 +22 -22 +71 +111 -111 -71 +442 +653 +690 -690 -653 +816 +130 +366 +441 -441 -366 -130 +950 -950 -816 +849 +423 +564 -564 +960 +294 +563 +360 -960 +24 +742 +979 +361 -361 -979 +452 +188 +500 +526 +77 -77 +373...

output:

GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGG...

result:

ok correct

Test #19:

score: 0
Accepted
time: 2ms
memory: 3964kb

input:

1000
+750 +840 -840 +962 -750 -962 +79 -79 +517 -517 +100 -100 +777 -777 +261 +442 +668 -442 -668 -261 +161 +421 -161 -421 +961 +221 +159 +933 -159 +304 +569 +201 -201 -569 -304 -933 -221 +987 +537 -961 +258 -258 +779 -779 +73 +480 -73 -480 -537 -987 +190 +472 +830 -472 -830 +863 -190 +188 +59 +464 ...

output:

GGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGSGGGGGGGSSGGGGGSGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGSGSSGGGGGGGGGGSGGGGGGGGGGSGGGGSSSGGSSGGGGGGGGGSGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGSGGGGGSGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGSGSGGGGGGGSGGGGGGGGGGSGGGGSGGGGGSGSSGGGSGGGSGGSSGGGGGGSGGGGGGGGGSGGSGGGGGGGGGGGSGGGGGSGGGGGSGSGGGG...

result:

ok correct

Test #20:

score: 0
Accepted
time: 2ms
memory: 3956kb

input:

1000
+358 +199 +801 -801 -199 -358 +761 -761 +781 -781 +93 -93 +638 -638 +159 -159 +175 -175 +622 +558 -622 -558 +993 -993 +164 +537 +862 -862 +948 +838 +742 -537 -742 -838 +594 -948 -594 -164 +498 -498 +412 -412 +832 -832 +420 -420 +805 +821 -821 -805 +377 +699 -377 -699 +775 +256 -775 -256 +577 -5...

output:

GGGGGGGGGGGGGGGGSSGGSGGSGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGSGGSGGSGGGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGGGGGGGGSGGGGGGSGGGGSGGGGGGGGGGGGGGGGSGGGGGSSGGGGGGGSGGGGGGGSGGGGGGSSGGGGGSSGGGGGGGGGSGGGGGGSGGGGGGGGSGGSGGGGGGGGGGGGGSGGGGGGGGGGGGSGGGGGGGGGGGGGGGGGSGGSGGGGGGGGGGGGGSGGGGGGGGGGGGSGGG...

result:

ok correct

Test #21:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

13
+7 -7 +4 -4 +3 +10 +5 -10 -3 +12 +6 +2 -2 +8 +1 -5 -1 +9 +13 -6 +11 -13 -12 -11 -9 -8

output:

*

result:

ok correct

Test #22:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

13
+6 +5 -6 +4 +10 -4 -10 -5 +12 -12 +9 +3 -9 +11 -3 +13 -13 +7 -7 -11 +2 +8 -2 -8 +1 -1

output:

GGGGGSGSSSSGG

result:

ok correct

Test #23:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

77
+29 -29 +12 +51 +66 +33 -12 +46 -66 +69 -69 +49 -33 -49 -46 -51 +60 +22 +25 -60 -25 +74 -22 +71 +52 -71 -52 -74 +9 -9 +31 -31 +64 -64 +77 +17 +57 -57 +20 +55 +62 +48 -77 -20 -62 +30 -48 +68 +3 -17 -30 -3 -55 +41 +6 +19 -6 -68 -19 +43 -43 -41 +72 -72 +28 -28 +59 +34 +65 -34 -65 +4 +53 +39 -53 -4 -...

output:

*

result:

ok correct

Test #24:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

77
+53 +45 +19 +15 -45 +6 -53 +72 +58 -58 +11 -15 -6 +37 +66 +4 +49 +5 -37 -19 +7 +69 +46 +57 -69 +55 +73 -72 +56 +38 +26 -38 -66 +1 -7 +67 -49 -26 +36 -4 -73 -36 -5 -46 +59 +31 +18 -56 +12 -55 -59 -18 +13 +40 -11 +3 -1 +54 +32 +48 +70 +76 -32 +74 -48 -12 +33 -40 -76 +22 -13 +51 -74 -57 -3 +27 -67 +...

output:

*

result:

ok correct

Test #25:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

77
+2 -2 +18 -18 +74 +44 +17 +52 +65 +32 -32 -44 +57 -74 +27 -65 +68 -68 +54 -57 -54 +7 +34 +71 +22 -27 -34 -7 +21 -17 -52 -22 -21 -71 +39 +59 +5 +42 +40 +9 -5 +10 +61 +23 +64 -39 +24 -10 +43 +33 +62 +25 +11 -11 -64 +37 +51 +58 -25 -51 -37 +72 -33 -59 -9 -40 -61 -42 -23 +16 -72 -58 +19 -16 +75 +60 -...

output:

*

result:

ok correct

Test #26:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

121
+9 -9 +113 +72 -113 +41 +53 +23 -23 -53 +69 +116 -69 -72 +75 -41 -116 +43 -75 -43 +110 +7 -7 -110 +90 +120 -90 +29 +56 -56 +92 -29 +94 -94 -92 +27 -120 +21 -27 -21 +36 +55 -55 +30 -36 -30 +121 +16 -121 -16 +73 +47 -73 -47 +4 -4 +19 +104 +50 +58 +109 -109 -58 -50 +102 -19 +45 +83 +77 -104 +28 +39...

output:

*

result:

ok correct

Test #27:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

121
+97 -97 +11 -11 +112 -112 +35 -35 +55 +67 -55 +102 +121 +86 -86 -121 -102 -67 +18 +73 -73 -18 +59 +30 -30 +19 -19 -59 +62 +83 +34 -83 -34 +36 -36 -62 +116 -116 +54 +69 -69 +93 +96 -54 +74 +79 -93 -79 +119 +39 -119 +70 +9 +61 -9 +53 +25 -53 +51 -61 -96 -39 +109 +75 -70 -51 +82 +108 +58 +4 +50 -10...

output:

*

result:

ok correct

Test #28:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

474
+447 -447 +246 -246 +452 -452 +380 +384 +33 +38 -38 -380 -384 +130 +383 +352 +167 +386 -352 +244 -386 -244 +373 +162 +268 +195 +453 +126 -373 +409 +449 +207 +88 +438 +232 -409 -195 +367 +5 -126 +218 +54 +205 +238 +103 +63 +194 +193 +337 +315 +272 -232 -449 -54 +282 -103 +299 -268 +296 +395 +10 -...

output:

*

result:

ok correct

Test #29:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

474
+415 +365 -415 +326 +77 +441 +305 +17 -441 -17 -326 -365 +338 +456 -456 +158 -338 +18 -77 +332 +388 +199 -332 +387 -305 -388 +242 +245 -387 +319 -245 -319 +135 +300 +427 +268 +146 +310 +152 +299 -18 -427 -158 -199 +80 -268 -242 +397 +254 -254 +100 -100 +372 +423 +215 +27 -372 +298 -423 +163 +195...

output:

*

result:

ok correct

Test #30:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

474
+357 -357 +226 -226 +466 -466 +400 +431 -400 -431 +229 -229 +286 -286 +105 +49 +470 +267 -470 -267 +450 -105 -49 -450 +249 +325 +149 +253 +25 +188 +83 +117 +48 -83 -188 -149 -253 +90 -90 -325 +382 +282 +63 +432 -63 +381 +339 +136 +449 +425 +202 -202 -25 +280 +66 +379 -280 +463 +145 -425 +168 -14...

output:

*

result:

ok correct

Test #31:

score: 0
Accepted
time: 2ms
memory: 3812kb

input:

737
+543 +552 -552 -543 +341 -341 +456 -456 +549 -549 +423 -423 +35 -35 +101 +715 -101 -715 +430 -430 +449 -449 +559 +229 +262 -559 +573 +409 -409 +644 +353 -644 -262 +237 -237 -229 +477 -353 +149 -477 +21 +345 -149 +618 -618 +698 +643 +292 -698 -292 +377 +395 +659 +356 +166 -377 -345 -166 +220 +584...

output:

*

result:

ok correct

Test #32:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

737
+229 +89 +541 -229 +71 +303 -303 -71 -541 +522 -89 -522 +393 +26 +55 +8 -26 +429 +36 -393 +238 -36 -8 +709 -429 +589 -238 +266 +379 +328 -379 -55 -589 -709 +641 -328 +724 -266 -724 +602 +412 +199 +270 +347 +169 +191 -602 +673 +206 +659 -347 +411 +158 -206 -673 +39 +615 +695 -695 +530 -169 -39 -6...

output:

*

result:

ok correct

Test #33:

score: 0
Accepted
time: 2ms
memory: 3864kb

input:

999
+119 -119 +10 -10 +480 +652 -480 +849 +215 -652 +106 +275 -275 +179 +309 +911 +950 +973 +730 +699 +585 +453 -730 -849 +285 +76 +641 -285 +977 +41 -641 -950 -585 -179 +773 -973 -911 +954 +292 -977 +318 -106 -773 +461 -309 +948 -948 -41 +619 -699 +181 +294 -181 -453 -619 -954 +334 +116 +546 +584 +...

output:

*

result:

ok correct

Test #34:

score: 0
Accepted
time: 3ms
memory: 3996kb

input:

999
+936 -936 +284 +337 -337 +686 +556 -686 -556 +297 +258 -297 +315 -284 -315 +180 +404 +239 +273 +21 -180 +888 -888 -404 -258 +455 -21 +119 -239 +75 -75 +921 +234 -273 +41 -119 -41 +743 +574 +449 +982 +635 +844 -449 -234 +111 +275 +739 +715 +758 -275 -455 -844 -574 +238 +821 +68 -111 -982 +359 -82...

output:

*

result:

ok correct

Test #35:

score: 0
Accepted
time: 3ms
memory: 4252kb

input:

999
+32 +641 +255 -32 -641 +203 -203 +576 +605 -576 +618 -605 -618 +801 -801 -255 +217 -217 +365 +103 -103 +362 -365 -362 +910 -910 +619 +223 +450 +379 -223 -619 +948 +685 -948 +503 -379 +703 -703 +597 -685 +655 +686 +638 +10 -597 +358 +850 +433 -850 +930 -655 +929 -358 +690 +682 +725 -930 -690 -638...

output:

*

result:

ok correct

Test #36:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

4
+1 +4 +2 +3 -4 -3 -1 -2

output:

GSSG

result:

ok correct

Test #37:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

4
+1 +4 +2 +3 -4 -3 -1 -2

output:

GSSG

result:

ok correct

Test #38:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

8
+1 +4 +2 +3 -4 -3 -1 -2 +6 +8 +5 +7 -8 -7 -5 -6

output:

GSSGGGGS

result:

ok correct

Test #39:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

8
+2 +1 +3 +4 -3 -1 -4 -2 +6 +5 +7 +8 -7 -5 -8 -6

output:

GGGSGGGS

result:

ok correct

Test #40:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

996
+1 +4 +2 +3 -4 -3 -1 -2 +5 +8 +6 +7 -8 -7 -5 -6 +10 +9 +11 +12 -11 -9 -12 -10 +13 +16 +14 +15 -16 -15 -13 -14 +18 +17 +19 +20 -19 -18 -20 -17 +22 +24 +21 +23 -24 -23 -21 -22 +26 +28 +25 +27 -28 -27 -25 -26 +30 +29 +31 +32 -31 -29 -32 -30 +33 +36 +34 +35 -36 -35 -33 -34 +37 +40 +38 +39 -40 -39 -3...

output:

GSSGGSSGGGGSGSSGGSSGGGGSGGGSGGGSGSSGGSSGGSSGGGGSGSSGGSSGGSSGGGGSGGGSGGGSGSSGGGGSGGGSGGGSGGGSGSSGGSSGGSSGGGGSGGGSGSSGGSSGGGGSGSSGGSSGGSSGGGGSGSSGGGGSGGGSGSSGGGGSGGGSGSSGGSSGGGGSGGGSGSSGGGGSGSSGGGGSGGGSGSSGGGGSGGGSGSSGGSSGGGGSGSSGGSSGGSSGGGGSGGGSGSSGGGGSGGGSGSSGGGGSGGGSGSSGGSSGGGGSGGGSGSSGGGGSGGGSGGGS...

result:

ok correct

Test #41:

score: 0
Accepted
time: 1ms
memory: 3936kb

input:

996
+2 +1 +3 +4 -3 -1 -4 -2 +6 +5 +7 +8 -7 -5 -8 -6 +10 +9 +11 +12 -11 -10 -12 -9 +14 +13 +15 +16 -15 -14 -16 -13 +18 +17 +19 +20 -19 -17 -20 -18 +22 +21 +23 +24 -23 -21 -24 -22 +26 +25 +27 +28 -27 -26 -28 -25 +30 +29 +31 +32 -31 -29 -32 -30 +33 +36 +34 +35 -36 -35 -33 -34 +38 +37 +39 +40 -39 -38 -4...

output:

GGGSGGGSGSSGGSSGGGGSGGGSGSSGGGGSGSSGGSSGGGGSGSSGGGGSGGGSGSSGGSSGGSSGGGGSGGGSGSSGGSSGGGGSGGGSGGGSGGGSGSSGGSSGGSSGGSSGGGGSGSSGGSSGGSSGGSSGGSSGGGGSGGGSGSSGGGGSGGGSGGGSGSSGGSSGGGGSGGGSGSSGGSSGGGGSGSSGGSSGGSSGGSSGGSSGGSSGGSSGGSSGGGGSGSSGGSSGGSSGGSSGGSSGGSSGGSSGGGGSGSSGGGGSGGGSGSSGGGGSGGGSGSSGGGGSGSSGGGGS...

result:

ok correct

Test #42:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

1000
+2 +4 +1 +3 -4 -3 -1 -2 +5 +8 +6 +7 -8 -7 -5 -6 +10 +12 +9 +11 -12 -11 -9 -10 +13 +16 +14 +15 -16 -15 -13 -14 +17 +20 +18 +19 -20 -19 -17 -18 +22 +24 +21 +23 -24 -23 -21 -22 +26 +25 +27 +28 -27 -25 -28 -26 +30 +29 +31 +32 -31 -30 -32 -29 +34 +33 +35 +36 -35 -33 -36 -34 +37 +40 +38 +39 -40 -39 -...

output:

GGGSGSSGGGGSGSSGGSSGGGGSGGGSGSSGGGGSGSSGGSSGGGGSGGGSGSSGGGGSGSSGGSSGGSSGGGGSGGGSGSSGGSSGGGGSGSSGGSSGGGGSGGGSGGGSGSSGGGGSGGGSGGGSGGGSGSSGGSSGGGGSGSSGGGGSGGGSGSSGGGGSGGGSGGGSGSSGGSSGGGGSGSSGGSSGGGGSGGGSGSSGGSSGGGGSGSSGGSSGGSSGGSSGGSSGGSSGGSSGGSSGGGGSGSSGGGGSGGGSGSSGGGGSGGGSGGGSGSSGGSSGGGGSGGGSGSSGGGGS...

result:

ok correct

Test #43:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

1000
+1 +4 +2 +3 -4 -3 -1 -2 +6 +5 +7 +8 -7 -5 -8 -6 +10 +9 +11 +12 -11 -10 -12 -9 +13 +16 +14 +15 -16 -15 -13 -14 +18 +17 +19 +20 -19 -18 -20 -17 +21 +24 +22 +23 -24 -23 -21 -22 +25 +28 +26 +27 -28 -27 -25 -26 +30 +29 +31 +32 -31 -29 -32 -30 +34 +36 +33 +35 -36 -35 -33 -34 +38 +37 +39 +40 -39 -38 -...

output:

GSSGGGGSGSSGGSSGGSSGGSSGGSSGGGGSGGGSGSSGGGGSGGGSGGGSGSSGGSSGGGGSGGGSGSSGGGGSGSSGGGGSGSSGGSSGGSSGGSSGGSSGGGGSGGGSGSSGGGGSGSSGGSSGGGGSGGGSGSSGGGGSGGGSGGGSGSSGGSSGGGGSGGGSGSSGGSSGGSSGGSSGGGGSGSSGGGGSGGGSGSSGGSSGGSSGGGGSGSSGGGGSGSSGGGGSGSSGGGGSGSSGGSSGGGGSGSSGGGGSGGGSGGGSGGGSGSSGGGGSGSSGGSSGGSSGGSSGGSSG...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed