QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#425323#6537. One, Two, ThreecrsfaaWA 2ms4372kbC++142.4kb2024-05-30 08:33:052024-05-30 08:33:06

Judging History

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

  • [2024-05-30 08:33:06]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:4372kb
  • [2024-05-30 08:33:05]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
	int s=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s;
}
using vec=vector<int>;
stack<vec> A,C,AB,CB;
stack<vec> ABC,ACB,ABCB;
//CBAB A
//CBA AB
vec get(stack<vec> &a)
{
	vec res=a.top();
	a.pop();
	return res;
}
vec operator +(vec x,vec y)
{
	for(auto i:y) x.push_back(i);
	return x;
}
const int mxn=6e6+5;
char s[mxn];
/*
CABBCA

6
3 1 2 2 3 1

6
1 2 3 2 1 3
*/
int main()
{
	int n=read(),i;
	for(i=0;i<n;i++)
	{
		int x=s[i]=read()+'A'-1;
		if(x=='A')
		{
			if(CB.size())
				ABC.push(get(CB)+vec{i});
			else if(ABCB.size())
			{
				vec tp=get(ABCB);
				if(s[tp[0]]==x)
					AB.push({tp[0],tp[1]}),
					ABC.push({tp[2],tp[3],i});
				else
					AB.push({tp[2],tp[3]}),
					ABC.push({tp[0],tp[1],i});
			}
			else if(ACB.size())
			{
				vec tp=get(ACB);
				if(s[tp[0]]==x)
					ABC.push({tp[1],tp[2],i}),
					A.push({tp[0]});
				else
					ABC.push({tp[0],tp[2],i}),
					A.push({tp[1]});
			}
			else A.push({i});
		}
		if(x=='B')
		{
			if(A.size()&&C.size())
			{
				vec ta=get(A),tb=get(C);
				ACB.push({min(ta[0],tb[0]),max(ta[0],tb[0]),i}); 
			}
			else if(ACB.size())
			{
				vec tp=get(ACB);
				if(s[tp[0]]=='A')
					AB.push({tp[0],i}),
					CB.push({tp[1],tp[2]});
				else
					CB.push({tp[0],i}),
					AB.push({tp[1],tp[2]});
			} 
			else if(A.size())
				AB.push(get(A)+vec{i});
			else if(C.size())
				CB.push(get(C)+vec{i});
			else if(ABC.size())
				ABCB.push(get(ABC)+vec{i});
		}
		if(x=='C')
		{
			if(AB.size())
				ABC.push(get(AB)+vec{i});
			else if(ABCB.size())
			{
				vec tp=get(ABCB);
				if(s[tp[0]]==x)
					CB.push({tp[0],tp[1]}),
					ABC.push({tp[2],tp[3],i});
				else
					CB.push({tp[2],tp[3]}),
					ABC.push({tp[0],tp[1],i});
			}
			else if(ACB.size())
			{
				vec tp=get(ACB);
				if(s[tp[0]]==x)
					ABC.push({tp[1],tp[2],i}),
					C.push({tp[0]});
				else
					ABC.push({tp[0],tp[2],i}),
					C.push({tp[1]});
			}
			else C.push({i});
		}
	}
	printf("%d\n",ABC.size()+ABCB.size());
	for(;ABC.size();ABC.pop())
		printf("%d %d %d\n",ABC.top()[0],ABC.top()[1],ABC.top()[2]);
	for(;ABCB.size();ABCB.pop())
		printf("%d %d %d\n",ABCB.top()[0],ABCB.top()[1],ABCB.top()[2]);
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3836kb

input:

6
3 1 2 2 3 1

output:

2
0 3 5
1 2 4

result:

ok count=2

Test #2:

score: 0
Accepted
time: 1ms
memory: 4060kb

input:

6
2 1 3 1 3 2

output:

0

result:

ok count=0

Test #3:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

3000
1 1 1 1 1 3 1 1 3 3 1 3 1 1 2 3 1 1 2 1 2 1 3 3 3 1 1 2 1 2 2 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 3 3 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 3 1 1 1 1 3 3 2 1 3 1 1 2 3 1 2 3 1 1 1 2 1 1 1 1 2 3 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 3 1 3 3 1 1 1 1 3 1 1 2 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 2 3 3 1...

output:

499
2996 2997 2999
2956 2992 2993
2983 2984 2985
2978 2980 2981
2968 2969 2970
2963 2965 2966
2960 2961 2962
2755 2758 2951
2760 2761 2940
2759 2762 2934
2765 2766 2931
2926 2928 2930
2855 2856 2927
2871 2872 2921
2873 2874 2919
2911 2912 2913
2885 2886 2909
2898 2900 2908
2884 2887 2899
2880 2881 2...

result:

ok count=499

Test #4:

score: 0
Accepted
time: 1ms
memory: 4236kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1
1932 1933 2901

result:

ok count=1

Test #5:

score: 0
Accepted
time: 1ms
memory: 4140kb

input:

3000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
1755 1756 2819

result:

ok count=1

Test #6:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1500
1 1 1 2 1 1 1 2 2 2 2 2 1 1 3 1 2 2 3 1 2 2 2 2 1 2 1 2 1 1 3 1 2 2 2 2 1 1 3 1 1 2 2 3 2 1 3 1 1 2 2 2 1 2 2 2 2 2 1 2 3 2 3 2 3 2 1 3 2 1 2 3 2 2 3 2 3 1 1 3 1 3 1 3 3 3 1 3 3 3 1 1 3 1 3 1 3 1 1 1 3 1 3 1 3 3 1 1 1 3 1 1 3 1 1 1 1 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 3 1 1 1 3 1 3 1 1 1 1 3 1...

output:

500
101 1278 1499
154 1277 1498
103 1279 1497
106 1280 1496
157 1276 1495
158 1275 1494
107 1281 1493
108 1282 1492
110 1283 1491
111 1284 1490
113 1285 1489
164 1274 1488
114 1286 1487
166 1273 1486
168 1272 1485
115 1287 1484
171 1271 1483
172 1270 1482
174 1269 1481
116 1288 1480
175 1268 1479
11...

result:

ok count=500

Test #7:

score: 0
Accepted
time: 1ms
memory: 4120kb

input:

3000
3 1 1 1 1 3 3 2 1 1 1 2 3 1 3 3 3 3 1 1 3 1 3 3 1 1 1 1 1 3 3 1 1 1 1 3 1 3 1 1 3 3 3 3 1 3 1 3 1 3 1 3 1 1 1 3 3 1 3 1 1 1 3 1 3 3 3 3 1 1 1 1 3 1 1 1 3 3 1 2 3 3 1 3 3 3 3 3 3 3 1 1 1 1 3 1 3 1 3 3 3 3 1 3 1 1 3 3 1 1 1 3 3 1 3 3 1 3 1 3 1 3 2 3 1 3 1 1 3 1 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2...

output:

1000
2680 2974 2999
2671 2975 2998
2682 2973 2997
2684 2977 2996
2675 2976 2995
2687 2972 2994
2659 2991 2993
2699 2971 2992
2688 2978 2990
2700 2979 2989
2669 2980 2988
2666 2981 2987
2661 2985 2986
2701 2970 2984
2662 2982 2983
2703 2936 2969
2702 2937 2968
2697 2938 2967
2685 2965 2966
2698 2939 ...

result:

ok count=1000

Test #8:

score: 0
Accepted
time: 1ms
memory: 4188kb

input:

3000
1 3 1 1 3 1 1 1 1 3 1 1 3 1 1 1 3 3 3 3 3 1 1 3 1 1 3 1 3 3 1 2 2 3 1 3 3 3 1 3 3 2 3 1 1 3 3 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 3 1 1 1 1 3 1 1 1 3 1 1 1 1 1 3 3 3 3 3 1 3 3 3 1 1 1 3 1 1 3 1 1 3 1 3 3 3 1 1 1 3 3 3 3 3 1 1 1...

output:

1000
1902 2934 2999
1869 2935 2998
1921 2933 2997
1922 2932 2996
1870 2936 2995
1871 2937 2994
1875 2938 2993
1876 2939 2992
1884 2940 2991
1923 2931 2990
1924 2930 2989
1925 2929 2988
1928 2928 2987
1933 2927 2986
1934 2926 2985
1885 2941 2984
1941 2925 2983
1952 2924 2982
1887 2942 2981
1888 2943 ...

result:

ok count=1000

Test #9:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

2997
3 1 2 2 1 1 1 1 1 1 3 1 3 3 1 3 3 3 1 3 1 2 1 1 3 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 3 1 1 3 1 3 1 1 3 3 1 3 1 3 3 3 1 1 1 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 1 3 1 1 1 1 1 3 3 3 1 3 1 1 3 3 3 1 3 3 1 1 1 3 1 1 3 1 1 3 2 3 3 3 2 3 2 3 1 2 1 1 3 1 1 3 2 2 2 2...

output:

999
959 2989 2996
983 2988 2995
961 2990 2994
958 2991 2993
1085 2987 2992
971 2985 2986
993 2983 2984
1044 2981 2982
1075 2753 2980
1021 2754 2979
1014 2755 2978
979 2756 2977
962 2757 2976
658 2814 2975
665 2815 2974
670 2816 2973
955 2758 2972
671 2817 2971
952 2759 2970
938 2760 2969
689 2813 29...

result:

ok count=999

Test #10:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

2994
1 1 2 1 2 1 2 2 3 1 3 3 3 3 1 3 1 1 2 3 3 1 3 3 3 3 1 1 1 3 3 2 3 1 3 1 3 3 1 2 3 1 3 3 3 1 3 1 3 2 3 2 1 1 3 1 1 1 3 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 1 1 2 3 3 3 3 3 3 1 3 1 3 1 1 2 1 3 3 3 2 2 3 2 1 3 3 3 1 2 1 1 2 3 3 1 3 2 2 2 2 2 2 2 2...

output:

998
2772 2987 2993
2798 2986 2992
2797 2988 2991
2796 2989 2990
2775 2984 2985
2776 2982 2983
2779 2980 2981
2801 2978 2979
2786 2970 2977
2800 2971 2976
2799 2974 2975
2778 2972 2973
2802 2968 2969
2804 2962 2967
2783 2965 2966
2803 2963 2964
2813 2960 2961
2820 2952 2959
2814 2955 2958
2781 2956 2...

result:

ok count=998

Test #11:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

3000
1 1 1 3 2 3 2 3 1 1 1 1 2 3 1 2 1 2 1 3 3 2 2 3 3 2 3 2 2 3 3 3 3 3 1 3 2 1 2 3 2 3 3 3 2 1 3 3 3 2 1 1 1 1 2 1 3 1 3 2 2 2 1 2 3 3 3 2 1 3 1 3 2 3 1 3 2 3 3 1 2 1 2 2 3 1 3 2 2 1 1 2 3 1 1 3 1 3 2 2 3 2 2 1 3 2 2 2 3 3 2 3 1 2 2 1 1 1 2 3 2 1 3 2 1 1 1 3 3 1 3 1 3 2 2 1 1 1 1 2 1 2 3 1 2 1 2 2...

output:

1000
2995 2996 2999
2978 2979 2998
2988 2989 2997
2923 2924 2994
2926 2927 2993
2910 2915 2992
2888 2900 2991
2977 2980 2990
2871 2872 2987
2868 2875 2986
2968 2973 2985
2969 2972 2984
2898 2899 2983
2889 2897 2982
2891 2896 2981
2970 2971 2976
2887 2895 2975
2877 2878 2974
2908 2909 2967
2874 2904 ...

result:

ok count=1000

Test #12:

score: 0
Accepted
time: 1ms
memory: 4092kb

input:

3000
2 2 1 3 2 2 2 3 2 2 2 2 2 1 2 2 2 2 2 1 3 2 2 2 2 3 2 2 2 2 2 2 1 3 2 2 2 2 2 2 2 2 2 2 1 3 2 2 2 1 2 3 2 3 1 2 2 3 2 3 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 3 2 2 1 2 3 2 1 3 3 2 3 2 2 2 3 1 2 2 2 2 1 2 3 3 1 2 1 1 2 2 2 1 2 2 2 2 2 2 1 2 3 1 2 1 2 2 3 2 2 2 2 2 2 2 2 2 3 1 2 2 2 2 3 2 3 3 1 2 2 1 2...

output:

673
1955 2934 2999
1363 2993 2994
1366 2989 2992
1365 2990 2991
1959 2935 2988
1961 2936 2987
1373 2981 2984
1371 2982 2983
1962 2937 2980
1376 2978 2979
1394 2965 2971
1390 2969 2970
1391 2967 2968
1965 2938 2966
1981 2942 2963
1401 2958 2960
1983 2944 2959
1986 2945 2955
1987 2946 2954
1994 2947 2...

result:

ok count=673

Test #13:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

2999
2 2 3 3 2 1 2 1 1 2 2 3 2 3 2 3 2 2 2 1 2 3 2 2 2 2 1 3 2 3 3 2 1 2 3 2 2 2 2 1 2 2 2 2 2 3 2 2 3 1 2 2 2 3 2 2 2 3 3 2 2 2 3 3 3 2 1 1 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 3 2 2 3 3 3 1 1 2 2 3 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 3 3 1 1 2 2 2 2 1 1 2 2 3 2 3 2 3 2 2 2 3 2 2 2 1 2 1 3 2 3 2 2 2 1...

output:

683
1370 2939 2998
1375 2930 2931
1992 2922 2929
1995 2923 2924
1994 2002 2920
1990 2918 2919
1989 2916 2917
1981 2914 2915
1904 2889 2890
1901 2101 2888
1908 2095 2887
1905 2096 2885
1902 2883 2884
1897 2104 2881
1888 2111 2879
1890 2875 2878
1891 2876 2877
1867 2870 2871
1845 2866 2867
1857 2161 2...

result:

ok count=683

Test #14:

score: 0
Accepted
time: 1ms
memory: 4116kb

input:

2998
2 1 2 1 3 2 2 2 2 2 2 2 1 2 2 2 2 3 3 2 1 2 1 2 2 3 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 3 1 3 2 2 1 2 2 2 3 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 3 2 1 2 3 2 2 3 3 2 2 2 2 1 2 1 2 2 2 2 3 2 3 3 3 1 2 2 2 2 2 3 2 2 2 1 2 2 2 2 2 2 2 3 2 2 3 3 2 1 1 2 2 3 3 2 1 2 2 2 2 2 2 2 2 3 2 1 2 1 2 2 3 1 2 3 2 2 2 2...

output:

629
1907 2832 2990
1304 2986 2987
1307 2984 2985
1909 2833 2979
1323 2974 2977
1321 2975 2976
1326 2972 2973
1910 2834 2970
1911 2835 2965
1912 2836 2964
1913 2837 2963
1344 2954 2958
1915 2840 2957
1343 2955 2956
1936 2842 2947
1944 2843 2946
1948 2844 2944
1949 2845 2941
1369 2936 2938
1951 2846 2...

result:

ok count=629

Test #15:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

2997
1 1 3 2 3 3 2 2 1 2 2 2 2 2 2 1 3 3 2 2 2 3 2 2 2 2 3 2 1 3 2 3 2 3 2 3 3 2 2 2 2 2 2 2 1 1 2 2 3 3 2 1 2 2 3 3 2 2 1 1 1 2 1 2 1 2 2 1 2 1 3 1 3 3 1 2 2 2 2 2 2 1 2 2 2 3 2 2 3 2 2 1 2 2 3 2 1 2 2 2 3 2 2 1 3 1 2 2 2 1 3 2 2 1 2 3 2 3 1 3 2 2 3 2 2 2 2 1 2 2 2 1 1 2 3 2 2 2 3 2 3 1 2 2 3 2 2 2...

output:

712
1329 2993 2996
1928 2891 2987
1937 2894 2985
1359 2961 2980
1344 2978 2979
1358 2962 2977
1353 2967 2976
1346 2974 2975
1940 2895 2973
1352 2968 2972
1348 2969 2971
1943 2896 2970
1354 2965 2966
1355 2963 2964
1944 2897 2956
1373 2952 2953
1956 2900 2951
1968 2901 2949
1974 2906 2948
1401 2930 2...

result:

ok count=712

Test #16:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1000
999 1000 2999
998 1001 2998
997 1002 2997
996 1003 2996
995 1004 2995
994 1005 2994
993 1006 2993
992 1007 2992
991 1008 2991
990 1009 2990
989 1010 2989
988 1011 2988
987 1012 2987
986 1013 2986
985 1014 2985
984 1015 2984
983 1016 2983
982 1017 2982
981 1018 2981
980 1019 2980
979 1020 2979
9...

result:

ok count=1000

Test #17:

score: 0
Accepted
time: 1ms
memory: 4040kb

input:

3000
1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

1
0 3 2999

result:

ok count=1

Test #18:

score: 0
Accepted
time: 0ms
memory: 4068kb

input:

15
2 3 3 2 1 3 2 1 1 1 3 2 3 1 2

output:

3
9 11 12
5 6 7
2 3 4

result:

ok count=3

Test #19:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

18
3 3 3 1 1 3 2 2 1 2 1 2 3 2 2 1 3 1

output:

6
5 6 17
4 13 16
0 14 15
3 11 12
1 9 10
2 7 8

result:

ok count=6

Test #20:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

16
1 3 3 2 1 3 1 2 2 2 3 1 3 2 1 2

output:

5
6 7 12
1 8 11
0 9 10
2 3 4
5 13 14

result:

ok count=5

Test #21:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

15
1 3 1 2 3 2 3 3 2 1 2 2 1 1 3

output:

5
9 11 14
7 8 13
1 10 12
0 5 6
2 3 4

result:

ok count=5

Test #22:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

18
1 3 1 3 2 1 1 3 2 2 2 3 2 3 2 1 1 3

output:

6
0 14 17
1 10 16
7 8 15
6 12 13
2 9 11
3 4 5

result:

ok count=6

Test #23:

score: 0
Accepted
time: 0ms
memory: 4032kb

input:

18
1 3 3 2 1 1 1 2 3 2 1 1 2 3 2 3 2 3

output:

6
0 16 17
5 14 15
11 12 13
1 9 10
6 7 8
2 3 4

result:

ok count=6

Test #24:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

18
1 2 1 2 3 2 3 3 2 2 3 1 1 3 3 1 2 1

output:

6
14 16 17
7 8 15
2 3 13
4 5 12
6 9 11
0 1 10

result:

ok count=6

Test #25:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

15
1 2 1 2 3 3 1 1 1 2 3 2 3 2 3

output:

5
6 13 14
7 11 12
8 9 10
0 1 5
2 3 4

result:

ok count=5

Test #26:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

18
3 2 1 2 1 3 3 1 1 3 2 1 2 3 2 1 2 3

output:

6
7 16 17
6 14 15
8 12 13
9 10 11
2 3 5
0 1 4

result:

ok count=6

Test #27:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

15
1 2 3 2 3 3 3 1 3 2 1 2 1 2 1

output:

5
5 13 14
6 11 12
8 9 10
2 3 7
0 1 4

result:

ok count=5

Test #28:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

18
2 1 2 2 2 2 1 3 1 3 3 3 2 2 2 2 3 2

output:

2
8 15 16
1 2 7

result:

ok count=2

Test #29:

score: 0
Accepted
time: 1ms
memory: 4136kb

input:

17
1 2 2 2 2 1 1 1 1 3 2 2 1 2 1 2 2

output:

1
0 1 9

result:

ok count=1

Test #30:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

16
1 2 2 2 2 3 3 1 3 3 2 2 2 2 3 2

output:

2
0 1 5
7 11 14

result:

ok count=2

Test #31:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

18
1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3

output:

5
4 5 16
3 6 15
2 7 14
1 8 13
0 9 12

result:

ok count=5

Test #32:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

6
1 2 3 2 3 1

output:

2
2 3 5
0 1 4

result:

ok count=2

Test #33:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

6
2 1 3 3 1 2

output:

0

result:

ok count=0

Test #34:

score: 0
Accepted
time: 1ms
memory: 3856kb

input:

6
3 1 2 2 3 1

output:

2
0 3 5
1 2 4

result:

ok count=2

Test #35:

score: 0
Accepted
time: 2ms
memory: 4072kb

input:

15000
2 1 3 1 1 2 3 1 3 1 1 1 3 2 2 2 1 3 2 3 3 3 3 2 1 1 2 2 1 1 1 1 1 1 3 3 3 3 3 1 3 1 2 1 1 1 1 1 2 1 2 1 2 1 3 3 3 3 3 2 2 1 1 2 3 3 3 2 3 2 1 2 1 1 1 1 1 3 2 3 2 1 1 2 1 1 1 1 3 2 1 2 1 1 2 1 2 1 2 1 3 3 2 3 2 3 1 2 1 3 3 1 2 2 3 1 2 3 2 3 3 1 1 1 3 3 2 2 2 2 2 1 3 3 3 2 2 1 2 1 3 3 3 3 2 2 1 ...

output:

4997
14985 14992 14993
13687 13688 14989
13643 13644 14988
12242 12243 14987
14972 14973 14986
14976 14978 14984
14980 14981 14983
13638 13639 14982
14975 14977 14979
12240 12241 14974
13474 13475 14971
13649 13650 14970
13689 13690 14969
13694 13695 14968
13697 13698 14967
13700 13701 14966
13606 1...

result:

ok count=4997

Test #36:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

15000
3 1 3 3 2 1 1 3 1 2 2 3 1 2 1 2 1 2 1 1 2 2 1 2 3 2 3 2 3 3 1 1 2 1 2 2 3 3 3 2 3 2 1 1 3 2 2 3 1 2 1 3 1 3 1 3 2 1 1 1 3 3 2 2 3 3 1 2 3 2 3 2 2 2 1 2 3 2 2 1 1 3 3 2 1 3 3 3 2 2 1 1 3 1 3 2 2 3 3 1 2 2 2 3 1 1 2 1 1 1 1 1 2 2 1 2 1 3 3 3 3 3 2 3 1 1 1 1 1 1 2 1 1 2 3 2 1 3 3 3 2 1 1 3 2 1 1 ...

output:

4999
14995 14997 14998
14971 14972 14994
14990 14991 14992
14965 14966 14989
14968 14969 14988
14982 14983 14987
14967 14970 14986
14912 14919 14985
14946 14947 14984
14549 14550 14981
14561 14562 14980
14584 14585 14979
14814 14815 14978
14964 14973 14977
14948 14949 14976
14891 14892 14975
14921 1...

result:

ok count=4999

Test #37:

score: 0
Accepted
time: 2ms
memory: 4068kb

input:

15000
1 2 1 3 2 3 2 3 2 3 3 1 3 3 1 1 3 1 2 3 1 1 3 2 1 2 1 2 1 1 2 1 1 1 3 3 1 2 3 3 3 1 3 3 2 1 3 3 3 3 1 3 2 3 3 1 3 2 3 1 3 3 1 2 2 2 1 3 3 2 3 2 3 3 2 3 2 1 1 3 2 3 3 1 1 1 3 1 3 1 2 1 3 2 2 1 2 1 2 3 3 1 1 2 1 1 3 3 3 3 1 1 2 2 3 1 2 1 3 1 1 3 2 3 1 2 1 3 1 1 3 3 3 1 3 3 3 1 2 2 2 1 2 1 3 2 3 ...

output:

4998
14987 14997 14998
14993 14994 14995
14960 14966 14989
14983 14986 14988
14978 14979 14985
14981 14982 14984
14975 14976 14977
14967 14968 14974
14949 14950 14973
14948 14951 14972
14969 14970 14971
14963 14964 14965
14941 14954 14962
14957 14959 14961
14943 14952 14958
14953 14955 14956
14880 1...

result:

ok count=4998

Test #38:

score: 0
Accepted
time: 2ms
memory: 4064kb

input:

15000
1 2 1 1 1 2 3 1 2 3 3 3 2 2 1 2 1 3 3 2 3 2 1 1 2 3 3 1 1 2 1 3 2 3 1 1 2 2 2 1 3 1 2 3 3 2 2 1 2 3 3 2 2 2 2 3 3 3 2 3 3 2 1 2 3 3 1 3 3 1 1 3 3 3 2 3 2 1 3 1 1 2 1 3 1 2 1 1 2 1 2 3 2 2 3 3 2 2 1 3 3 2 3 1 2 2 3 3 2 3 1 3 1 1 3 1 3 3 1 3 1 2 2 2 1 3 1 3 2 2 2 2 3 2 1 2 2 3 3 1 2 3 1 1 3 1 2 ...

output:

5000
14267 14295 14999
14837 14838 14998
14831 14839 14997
14830 14840 14996
14983 14994 14995
14828 14841 14993
14989 14991 14992
14775 14851 14990
14984 14987 14988
14947 14951 14986
14980 14981 14985
14952 14955 14982
14940 14941 14979
14970 14971 14978
14858 14861 14977
14773 14862 14976
14973 1...

result:

ok count=5000

Test #39:

score: 0
Accepted
time: 2ms
memory: 4372kb

input:

15000
3 3 1 1 1 1 3 3 3 3 3 1 3 1 3 1 1 3 1 3 3 3 3 1 2 3 3 3 3 3 3 3 3 3 3 1 3 1 1 3 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 3 1 1 3 2 1 1 1 1 3 3 1 3 3 1 3 1 3 1 1 3 1 3 3 1 1 1 1 1 3 1 1 3 3 1 1 3 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 1 3 3 3 2 1 3 2 3 1 1 ...

output:

5000
949 14238 14999
1427 14237 14998
1428 14236 14997
951 14239 14996
1429 14235 14995
952 14240 14994
1430 14234 14993
954 14241 14992
1431 14233 14991
955 14242 14990
956 14243 14989
965 14244 14988
1435 14232 14987
967 14245 14986
1436 14231 14985
1437 14230 14984
1440 14229 14983
1441 14228 149...

result:

ok count=5000

Test #40:

score: -100
Wrong Answer
time: 0ms
memory: 4076kb

input:

15000
3 1 3 1 3 3 1 1 1 1 3 3 3 3 3 3 1 1 3 1 1 3 3 3 3 3 3 3 3 3 2 3 1 3 3 3 3 3 3 1 3 1 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 1 1 3 1 1 3 1 1 3 2 2 2 2 3 2 2 2 2 2 2 2 2 2 1 1 1 3 1 1 1 3 3 3 3 1 1 1 1 3 1 3 1 1 3 1 2 1 2 1 3 1 3 1 1 1 1 3 3 3 3 ...

output:

4995
6644 14965 14999
6765 14964 14998
3555 14966 14997
6904 14963 14996
3552 14993 14995
7092 14962 14994
7126 14961 14992
3556 14967 14991
14949 14960 14990
14950 14959 14989
3557 14968 14988
3558 14969 14987
3570 14970 14986
3571 14971 14985
14952 14958 14984
3572 14972 14983
3575 14973 14982
357...

result:

wrong answer the number of matches is different