QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#358510#407. Toiletsrobsob20060 1ms3696kbC++141.1kb2024-03-19 20:26:492024-03-19 20:26:49

Judging History

你现在查看的是最新测评结果

  • [2024-03-19 20:26:49]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3696kb
  • [2024-03-19 20:26:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

char tab[400007];
queue <int> kicked;
int vis[400007];

int main()
{
    int n, m, k, i, j, a, b, men=0, s, inst=0, ok;
    cin >> n;
    cin >> m;
    for(i=0; i<m; i++){
        cin >> tab >> k;
        for(j=0; j<strlen(tab); j++){
            if(tab[j]=='M'){
                men+=k;
            }
        }
    }
    if(men>n){
        cout << "-1\n";
        return 0;
    }
    a=0;
    b=1;
    while(a<2*n){
        if((tab[a]=='M')&&(tab[b]=='M')){
            while((tab[b]=='M')||(vis[b]==1)){
                b++;
                if(b==2*n){
                    inst++;
                    break;
                }
            }
        }
        //cout << a << ' ' << b << '\n';
        vis[a]=1;
        vis[b]=1;
        while(vis[a]==1){
            a++;
            if(a>2*n){
                break;
            }
        }
        b=a+1;
        while(vis[b]==1){
            b++;
            if(b>=2*n){
                inst++;
                break;
            }
        }
    }
    cout << inst << '\n';
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3696kb

input:

10
1
FMFFFFFFMFFFMMMMMFMM 1

output:

6

result:

wrong answer 1st lines differ - expected: '5', found: '6'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%