Submission #257957

# Submission time Handle Problem Language Result Execution time Memory
257957 2020-08-05T06:24:35 Z 임성재(#5053) Toilets (JOI16_toilets) C++17
0 / 100
3 ms 3456 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(NULL)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define all(v) (v).begin(), (v).end()
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9;
const ll INF = 1e18;

ll n, m;
string s[100010];
int k[100010];
priority_queue<int> F, M;

int main() {
	fast;

	cin >> n;
	cin >> m;

	for(int i=1; i<=m; i++) {
		cin >> s[i] >> k[i];
	}

	for(int i=0; i<s[1].size(); i++) {
		if(s[1][i] == 'F') F.em(i);
		else M.em(i);
	}

	int ans = 0;
	while(M.size() && F.size()) {
		int x = F.top();
		int y = M.top();

		F.pop();
		M.pop();

		ans = max(ans, y - x - 1);
	}

	if(M.size()) {
		cout << "-1";
	}
	else cout << ans;
}

Compilation message

toilets.cpp: In function 'int main()':
toilets.cpp:35:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<s[1].size(); i++) {
               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3456 KB Output isn't correct
2 Halted 0 ms 0 KB -