QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#132246#1403. JOIOJISaKaTa0 1ms3720kbC++14927b2023-07-29 09:44:542023-07-29 09:44:55

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-29 09:44:55]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3720kb
  • [2023-07-29 09:44:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 9 + 1e6;
const int oo = 7 + 1e9;

map<pair<int, int>, int> m;

void SaKaTa()
{
    int n;
    scanf("%d", &n);
    string s;
    cin >> s;
    pair<int, int> FIND(0, 0);
    m[FIND] = -1;
    int ans = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'J') ++FIND.first, ++FIND.second;
        else if (s[i] == 'O') --FIND.first;
        else --FIND.second;
        if (m.count(FIND)) ans = max(ans, i - m[FIND]);
        else m[FIND] = i;
    }
    printf("%d", ans);
}

int32_t main()
{
#define TASKNAME "FINDS"
    cin.tie(0)->sync_with_stdio(0);
    if (fopen(TASKNAME ".inp", "r"))
    {
        freopen(TASKNAME ".inp", "r", stdin);
        freopen(TASKNAME ".out", "w", stdout);
    }
    int testcase = 1;
    //    scanf("%d", &testcase);
    while (testcase--)
        SaKaTa();
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

50
IOJJJJIIIOOJOOOIOIJIJIOOOOJJOOOJIOIJIOIJIOIIIJOJJJ

output:

0

result:

wrong answer 1st lines differ - expected: '33', found: '0'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%