제출 #258497

#제출 시각아이디문제언어결과실행 시간메모리
258497arnold518Toilets (JOI16_toilets)C++14
36 / 100
16 ms7184 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll MAXN = 1e18;
const int MAXM = 2e5;

ll N; int M;
string S[MAXM+10];
int K[MAXM+10];

int main()
{
	int i, j;
	//ios_base::sync_with_stdio(false);

	cin>>N>>M;
	for(i=1; i<=M; i++) cin>>S[i]>>K[i];

	int t=0, k=1;
	for(i=S[1].size()-1; i>=0; i--)
	{
		if(S[1][i]=='F') t--;
		else t++;
		k=max(k, t);
	}

	if(t>0) return !printf("-1\n");
	printf("%d\n", k-1);
}

컴파일 시 표준 에러 (stderr) 메시지

toilets.cpp: In function 'int main()':
toilets.cpp:17:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...