Submission #55420

# Submission time Handle Problem Language Result Execution time Memory
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++)
                        ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -