General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
5943943 Practice:
Azami
400B - 17 GNU C++0x Accepted 31 ms 1164 KB 2014-03-05 21:43:45 2014-03-05 21:43:46
 
 
→ Source
#include <bits/stdc++.h>
using namespace std;
#define TR(i,v) 		for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x) 		cout << #x << " = "; cout << x << endl;
#define SIZE(p) 		(int)(p).size()
#define MP(a, b)		make_pair((a), (b))
#define ALL(p)			(p).begin(), (p).end()
#define rep(i, n)		for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)	for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)   	for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)  	for(int (i)=(int)(b); (i)>=(int)(a); --(i)) 
typedef long long LL;
typedef pair<int, int> pii;
char g[1005][1005], p[1005];
int main(int argc, char const *argv[])
{
	#ifndef ONLINE_JUDGE
    freopen("B.in", "r", stdin);	
    // freopen("out", "w", stdout);
    #endif
	// ios::sync_with_stdio(false);    cin.tie(0);
	int n, m;
	cin>>n>>m;
	rep(i, n)		scanf("%s", g[i]);
	bool ff = false;
	set<int> d;
	rep(i, n)
	{
		int a=-1, b=-1;
		rep(j, m)	
		{
			if(g[i][j] == 'G')		a = j;
			if(g[i][j] == 'S')		b = j;
		}		
		if(a>b)		return puts("-1"), 0;
		d.insert(b-a);
	}	
	printf("%d\n", SIZE(d));
	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details