답안 #55420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55420 2018-07-07T09:08:51 Z 뚜룹뚭스(#2071) Toilets (JOI16_toilets) C++11
0 / 100
2 ms 248 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>

using namespace std;

string arr;

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    long long n, k;
    int m;
    cin >> n >> m >> arr >> k;
    assert(m == 1 && k == 1);

    vector<int> a, b;
    for(int i = n - 1; i >= 0; i--)
    {
        if(arr[i] == 'F')
            a.push_back(i);
        else
            b.push_back(i);
    }

    if(a.size() < b.size())
        printf("-1\n");
    else
    {
        int mx = 0;
        for(int i = 0; i < b.size(); i++)
            mx = max(mx, b[i] - a[i] - 1);
        printf("%d\n", mx);
    }
    return 0;
}

Compilation message

toilets.cpp: In function 'int main()':
toilets.cpp:46:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < b.size(); i++)
                        ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -