Submission #366985

# Submission time Handle Problem Language Result Execution time Memory
366985 2021-02-15T22:46:28 Z MilosMilutinovic JOIOJI (JOI14_joioji) C++14
95 / 100
45 ms 6252 KB
#include <bits/stdc++.h>
using namespace std;
const int N=2000050;
int n;
char s[N];
int main(){
	scanf("%i%s",&n,s);
	map<pair<int,int>,int> lst;
	map<char,int> cnt;
	int ans=0;
	for(int i=0;i<n;i++){
		cnt[s[i]]++;
		pair<int,int> curr;
		curr.first=cnt['J']-cnt['O'];
		curr.second=cnt['J']-cnt['I'];
		if(lst[curr]!=0){
			ans=max(ans,i-lst[curr]+1);
		}else lst[curr]=i+1;
	}
	printf("%i",ans);
	return 0;
}

Compilation message

joioji.cpp: In function 'int main()':
joioji.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |  scanf("%i%s",&n,s);
      |  ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 372 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 492 KB Output is correct
2 Correct 7 ms 1004 KB Output is correct
3 Correct 12 ms 1516 KB Output is correct
4 Correct 22 ms 2412 KB Output is correct
5 Correct 38 ms 3568 KB Output is correct
6 Correct 44 ms 3692 KB Output is correct
7 Correct 45 ms 4076 KB Output is correct
8 Correct 45 ms 3564 KB Output is correct
9 Correct 44 ms 3820 KB Output is correct
10 Correct 43 ms 3564 KB Output is correct
11 Correct 39 ms 5228 KB Output is correct
12 Correct 34 ms 2284 KB Output is correct
13 Correct 30 ms 1644 KB Output is correct
14 Correct 35 ms 6252 KB Output is correct
15 Correct 24 ms 1408 KB Output is correct