Hello guyz,↵
Today I was solving Japan 2014 IOI National Team Selection Camp Day 3 Problem [Problem](https://oj.uz/problem/view/JOI14_joioji) 1 on [OJ.UZ](oj.uz) and was shocked that I somehow managed to get 95 points where the subtasks are:↵
↵
<spoiler summary="Subtasks">↵
- Subtask 1(5 points): N <= 200↵
- Subtask 2(15 points): N <= 4, 000↵
- Subtask 3(80 points): N <= 200, 000↵
</spoiler>↵
↵
<spoiler summary="My First Code">↵
↵
~~~~~↵
#include <iostream>↵
#include <algorithm>↵
#include <cmath>↵
#include <vector>↵
#include <string>↵
#include <set>↵
#include <unordered_set>↵
#include <map>↵
#include <unordered_map>↵
#include <queue>↵
#include <stack>↵
#include <iomanip>↵
#include <ios>↵
#include <cstdint>↵
#include <array>↵
#include <deque>↵
#include <numeric>↵
↵
using namespace std;↵
↵
#define MyFast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)↵
#define int long long↵
↵
constexpr long long N = 21;↵
constexpr long long MOD = 1e9 + 7;↵
↵
void solve()↵
{↵
int n;↵
cin >> n;↵
string s;↵
cin >> s;↵
↵
vector <int> ans(n + 1);↵
map <int, int> mp;↵
↵
int O = 0, I = 0, J = 0, fi = 0;↵
↵
for(int i = 0 ; i < n ; ++i)↵
{↵
if(s[i] == 'J')↵
{↵
J ++;↵
}↵
if(s[i] == 'I')↵
{↵
I ++;↵
}↵
if(s[i] == 'O')↵
{↵
O ++;↵
}↵
int temp = min(J, min(O, I));↵
J -= temp;↵
O -= temp;↵
I -= temp;↵
ans[i + 1] = temp + ans[i];↵
↵
if(mp[J + O * n + I * n * n])↵
{↵
fi = max(fi, ans[i + 1] - ans[mp[J + O * n + I * n * n]]);↵
}↵
else↵
{↵
mp[J + O * n + I * n * n] = i + 1;↵
}↵
}↵
cout << 3 * fi << endl;↵
}↵
↵
signed main()↵
{↵
MyFast;↵
int t = 1;↵
//cin >> t;↵
↵
while (t--)↵
{↵
solve();↵
}↵
}↵
~~~~~↵
</spoiler>↵
↵
It somehow gave me 95 points while this is one of the obvious cases where it will fail:↵
↵
↵
~~~~~↵
INPUT↵
6↵
JOIJOI↵
~~~~~↵
↵
↵
~~~~~↵
OUTPUT↵
3↵
EXPECTED OUTPUT↵
6↵
~~~~~↵
↵
Afterwards I wanted to report this and looked for a place where I can give edge cases but found none on the website so if anyone knows it please let me know. And if any of the staff of JOI or OJ.UZ reads this blog please fix it.↵
↵
**UPD : I Found [user:ojuz,2026-10-04], so please fix it because it is causing so much problem as in our series of contests thiscan cause me my rankputs ranks to unfair level.**
Today I was solving Japan 2014 IOI National Team Selection Camp Day 3 Problem [Problem](https://oj.uz/problem/view/JOI14_joioji) 1 on [OJ.UZ](oj.uz) and was shocked that I somehow managed to get 95 points where the subtasks are:↵
↵
<spoiler summary="Subtasks">↵
- Subtask 1(5 points): N <= 200↵
- Subtask 2(15 points): N <= 4, 000↵
- Subtask 3(80 points): N <= 200, 000↵
</spoiler>↵
↵
<spoiler summary="My First Code">↵
↵
~~~~~↵
#include <iostream>↵
#include <algorithm>↵
#include <cmath>↵
#include <vector>↵
#include <string>↵
#include <set>↵
#include <unordered_set>↵
#include <map>↵
#include <unordered_map>↵
#include <queue>↵
#include <stack>↵
#include <iomanip>↵
#include <ios>↵
#include <cstdint>↵
#include <array>↵
#include <deque>↵
#include <numeric>↵
↵
using namespace std;↵
↵
#define MyFast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)↵
#define int long long↵
↵
constexpr long long N = 21;↵
constexpr long long MOD = 1e9 + 7;↵
↵
void solve()↵
{↵
int n;↵
cin >> n;↵
string s;↵
cin >> s;↵
↵
vector <int> ans(n + 1);↵
map <int, int> mp;↵
↵
int O = 0, I = 0, J = 0, fi = 0;↵
↵
for(int i = 0 ; i < n ; ++i)↵
{↵
if(s[i] == 'J')↵
{↵
J ++;↵
}↵
if(s[i] == 'I')↵
{↵
I ++;↵
}↵
if(s[i] == 'O')↵
{↵
O ++;↵
}↵
int temp = min(J, min(O, I));↵
J -= temp;↵
O -= temp;↵
I -= temp;↵
ans[i + 1] = temp + ans[i];↵
↵
if(mp[J + O * n + I * n * n])↵
{↵
fi = max(fi, ans[i + 1] - ans[mp[J + O * n + I * n * n]]);↵
}↵
else↵
{↵
mp[J + O * n + I * n * n] = i + 1;↵
}↵
}↵
cout << 3 * fi << endl;↵
}↵
↵
signed main()↵
{↵
MyFast;↵
int t = 1;↵
//cin >> t;↵
↵
while (t--)↵
{↵
solve();↵
}↵
}↵
~~~~~↵
</spoiler>↵
↵
It somehow gave me 95 points while this is one of the obvious cases where it will fail:↵
↵
↵
~~~~~↵
INPUT↵
6↵
JOIJOI↵
~~~~~↵
↵
↵
~~~~~↵
OUTPUT↵
3↵
EXPECTED OUTPUT↵
6↵
~~~~~↵
↵
Afterwards I wanted to report this and looked for a place where I can give edge cases but found none on the website so if anyone knows it please let me know. And if any of the staff of JOI or OJ.UZ reads this blog please fix it.↵
↵
**UPD : I Found [user:ojuz,2026-10-04], so please fix it because it is causing so much problem as in our series of contests this




