QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#39844#1191. Reordering the DocumentsCrysflyAC ✓34ms12796kbC++2.9kb2022-07-14 09:11:442022-07-14 09:11:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-14 09:11:45]
  • 评测
  • 测评结果:AC
  • 用时:34ms
  • 内存:12796kb
  • [2022-07-14 09:11:44]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

// modint
#define mod 1000000007
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 300005
#define inf 0x3f3f3f3f

int n,k,m,o[maxn];

struct node{
	int mn,mx,s;
	node(int X=0,int Y=0,int Z=0){mn=X,mx=Y,s=Z;}
	void operator +=(node b){
		if(!b.s)return;
		if(!s)return (*this)=b,void();
		if(mx>b.mn) puts("0"),exit(0);
		mx=b.mx,s+=b.s; 
	}
}a[maxn];

modint f[5005],g[5005];

signed main()
{
	n=read(),k=read();
	For(i,1,n)o[i]=read();
	int mx=0;
	For(i,1,n){
		if(o[i]>mx) mx=o[i],a[++m]=node(o[i],o[i],1),a[++m]=node(0,0,0);
		else a[m]+=node(o[i],o[i],1); 
	}
	for(int i=m-3;i>=1;i-=2){
		if(a[i+3].s&&a[i].mx>a[i+3].mn)
			a[i]+=a[i+2],a[i+1]+=a[i+3],a[i+2].s=a[i+3].s=0;
	}
	f[0]=1;
	for(int i=1;i<=m;i+=2){
		if(!a[i].s&&!a[i+1].s)continue;
		For(j,0,n) if(f[j].x) g[j+a[i].s]+=f[j],g[j+a[i+1].s]+=f[j];
		For(j,0,n) f[j]=g[j],g[j]=0;
	}
	modint res=0;
	For(i,0,n) if(i<=k&&n-i<=k) res+=f[i];
	cout<<res.x;
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 10680kb

input:

6 3
1 3 4 2 6 5

output:

4

result:

ok answer is '4'

Test #2:

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

input:

6 6
1 3 4 2 6 5

output:

8

result:

ok answer is '8'

Test #3:

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

input:

4 4
4 3 1 2

output:

0

result:

ok answer is '0'

Test #4:

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

input:

6 3
1 3 4 2 6 5

output:

4

result:

ok answer is '4'

Test #5:

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

input:

6 6
1 3 4 2 6 5

output:

8

result:

ok answer is '8'

Test #6:

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

input:

4 4
4 3 1 2

output:

0

result:

ok answer is '0'

Test #7:

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

input:

1000 500
4 5 6 8 10 11 12 13 14 15 20 23 25 26 28 29 33 35 1 2 36 38 3 7 41 9 16 44 48 17 18 51 52 53 19 21 54 22 24 59 61 62 27 67 30 31 32 34 68 69 37 39 73 40 76 77 42 81 83 43 85 45 87 46 89 94 47 95 49 50 97 101 55 103 105 56 57 58 106 60 108 110 63 111 114 64 115 65 119 66 70 71 120 121 72 124...

output:

11363968

result:

ok answer is '11363968'

Test #8:

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

input:

1000 500
1 3 5 7 8 11 12 13 15 18 19 21 25 26 28 30 32 2 4 6 34 9 36 37 10 38 39 14 41 43 44 16 45 17 20 22 46 50 52 23 53 54 24 55 57 27 29 58 61 31 63 64 33 35 66 40 69 42 72 73 47 48 49 51 76 77 80 56 81 59 83 60 62 65 84 67 68 85 70 71 74 87 75 78 79 88 82 86 93 95 89 96 90 97 91 92 94 103 106 9...

output:

809753703

result:

ok answer is '809753703'

Test #9:

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

input:

1000 500
1 2 4 5 6 7 8 12 13 14 17 22 23 24 27 30 31 33 34 37 38 42 45 46 47 48 49 50 51 52 54 57 58 61 63 64 66 67 68 69 76 78 79 81 82 83 84 90 91 92 93 95 97 98 3 9 10 11 15 16 99 105 18 106 108 109 19 20 21 25 26 28 113 118 123 29 32 129 133 35 134 36 39 40 135 41 137 43 142 44 143 145 147 53 55...

output:

292864

result:

ok answer is '292864'

Test #10:

score: 0
Accepted
time: 4ms
memory: 12252kb

input:

1000 500
2 3 6 8 10 12 13 16 17 19 1 4 5 21 7 9 11 14 15 18 20 22 25 26 23 27 24 32 35 28 29 30 31 33 36 42 34 37 43 38 39 45 40 48 41 51 44 53 55 56 46 47 57 49 50 58 59 52 54 63 60 64 61 62 65 68 66 67 69 70 73 71 72 74 75 77 81 84 86 76 91 92 95 96 99 101 78 79 80 102 103 82 104 83 85 87 109 113 ...

output:

957884317

result:

ok answer is '957884317'

Test #11:

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

input:

1000 500
2 3 4 5 7 8 9 11 14 18 21 22 23 26 28 33 35 37 38 40 41 47 49 50 51 53 54 55 59 60 61 63 64 65 66 70 73 75 77 79 80 87 88 90 95 96 99 100 101 102 103 104 108 109 110 111 114 115 116 117 121 122 126 128 1 6 10 129 130 12 132 133 13 134 135 15 141 16 142 143 17 19 20 24 145 25 27 29 30 147 14...

output:

20979531

result:

ok answer is '20979531'

Test #12:

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

input:

2000 1000
1 2 3 7 9 16 17 18 19 21 22 24 27 30 31 32 34 37 39 40 42 43 45 46 47 49 50 55 56 57 58 60 63 64 65 66 4 70 71 72 74 5 75 6 78 79 8 80 82 10 11 12 13 14 15 84 86 20 23 25 88 90 91 92 26 93 96 28 29 98 33 99 100 102 35 104 107 36 38 41 44 48 109 112 51 52 113 116 117 53 118 122 123 125 54 5...

output:

290071346

result:

ok answer is '290071346'

Test #13:

score: 0
Accepted
time: 4ms
memory: 12268kb

input:

2000 1000
2 4 6 9 10 14 16 17 20 22 23 24 27 29 31 33 35 40 42 47 48 49 51 56 59 60 62 65 67 68 70 71 74 75 78 79 82 86 93 95 96 97 98 99 100 101 102 104 105 109 111 113 115 117 118 122 123 124 125 127 130 132 133 134 135 136 137 141 142 145 147 148 154 156 158 159 160 161 169 173 175 176 178 179 18...

output:

64

result:

ok answer is '64'

Test #14:

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

input:

2000 1000
3 9 10 11 1 2 4 15 16 5 18 19 20 21 6 25 26 7 28 8 12 29 13 14 32 35 36 39 17 40 41 22 23 43 44 24 53 27 55 56 30 31 59 33 60 34 37 62 38 65 70 71 42 72 73 45 74 46 75 47 77 48 80 49 85 86 50 51 87 88 52 54 57 58 61 63 64 66 89 67 94 68 69 96 76 100 101 78 102 79 103 104 107 81 110 82 111 ...

output:

235072

result:

ok answer is '235072'

Test #15:

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

input:

2000 1000
1 4 5 7 9 11 14 15 18 20 22 23 24 28 29 30 31 33 34 37 38 39 40 41 44 46 47 49 50 52 54 60 61 62 68 69 70 71 72 77 81 84 2 86 3 91 92 6 8 10 95 96 12 99 101 102 13 103 104 109 113 115 116 16 117 17 119 120 121 122 125 126 127 132 19 21 134 25 135 26 27 32 35 36 42 43 45 137 48 138 141 51 5...

output:

166912791

result:

ok answer is '166912791'

Test #16:

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

input:

2000 1000
2 3 4 5 7 8 9 11 14 18 21 22 23 26 28 33 35 37 38 40 41 47 49 50 51 53 54 55 59 60 61 63 64 65 66 70 73 75 77 79 80 87 1 6 10 12 88 13 15 16 90 17 19 95 20 96 99 24 100 101 102 25 103 104 108 109 27 29 30 110 31 32 111 114 115 116 34 117 121 36 122 126 39 42 43 128 44 129 130 45 132 133 46...

output:

418696764

result:

ok answer is '418696764'

Test #17:

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

input:

3000 1500
1 2 3 7 9 16 17 18 19 21 22 24 27 30 31 32 34 37 39 40 42 43 45 46 47 49 50 55 56 57 58 60 63 64 65 66 70 71 72 74 75 78 79 80 82 84 86 88 90 91 92 93 96 98 99 100 102 104 107 109 112 113 116 117 118 122 123 125 127 131 132 133 136 138 139 140 141 144 146 147 149 150 153 154 157 158 161 4 ...

output:

505570241

result:

ok answer is '505570241'

Test #18:

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

input:

3000 1500
2 4 6 9 10 14 16 17 20 22 23 24 27 29 31 33 35 40 42 47 48 49 51 56 59 60 62 65 67 68 70 71 74 75 78 79 82 86 93 95 96 97 98 99 100 101 102 104 105 109 111 113 115 117 118 122 123 124 125 127 130 132 133 134 135 136 137 141 142 145 147 148 154 156 158 159 160 161 169 173 175 176 178 179 18...

output:

2

result:

ok answer is '2'

Test #19:

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

input:

3000 1500
3 9 10 11 15 16 18 19 20 21 25 26 28 29 32 35 36 39 40 41 43 44 53 55 56 59 60 62 65 70 71 1 72 73 2 74 4 75 77 80 85 86 5 87 6 88 7 8 89 94 96 12 13 100 101 14 17 102 103 104 22 107 23 24 110 27 30 31 111 112 114 115 33 34 37 116 117 38 119 120 121 122 42 45 124 46 47 48 49 50 125 126 127...

output:

2024192

result:

ok answer is '2024192'

Test #20:

score: 0
Accepted
time: 5ms
memory: 11824kb

input:

3000 1500
1 4 5 7 9 11 14 15 2 3 6 18 20 8 10 12 22 13 16 17 23 24 28 29 30 31 19 21 25 26 33 27 32 34 35 37 38 39 36 40 41 44 46 42 43 47 49 50 52 45 48 51 53 54 60 55 61 62 68 69 56 57 58 59 70 63 71 64 65 66 72 77 67 73 81 84 74 75 86 91 76 78 79 92 80 82 95 96 99 101 102 103 104 83 109 113 85 87...

output:

697783719

result:

ok answer is '697783719'

Test #21:

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

input:

3000 1500
2 3 4 5 7 8 9 11 14 18 21 22 23 26 28 33 35 37 38 40 41 47 49 50 51 53 54 55 59 60 1 6 61 63 64 10 12 65 13 66 15 70 16 73 75 77 17 19 79 80 20 87 24 88 90 25 27 29 30 31 32 34 95 36 96 99 100 39 101 42 102 43 44 45 103 46 48 52 104 56 57 108 58 62 67 68 109 110 111 114 115 116 69 117 71 7...

output:

721286793

result:

ok answer is '721286793'

Test #22:

score: 0
Accepted
time: 4ms
memory: 11456kb

input:

4000 2000
1 2 3 7 9 16 17 18 19 21 22 24 27 30 31 32 34 37 39 40 42 43 45 46 47 49 50 55 56 57 58 60 63 64 65 66 70 71 72 74 75 78 79 80 82 84 86 88 90 91 92 93 96 98 99 100 102 104 107 109 112 113 116 117 118 122 123 125 127 131 132 133 136 138 139 140 141 144 146 147 149 150 153 154 157 158 161 16...

output:

474181687

result:

ok answer is '474181687'

Test #23:

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

input:

4000 2000
1 3 5 7 8 11 12 13 15 18 19 2 21 25 4 26 28 30 6 9 10 14 16 17 32 34 20 36 37 38 39 41 43 22 23 44 24 45 27 46 50 52 29 53 54 31 55 33 57 35 58 40 61 63 64 42 47 66 69 48 72 49 51 73 56 76 77 59 80 60 81 62 65 83 67 68 84 85 70 87 71 74 75 78 88 79 82 86 89 90 91 93 95 96 97 98 99 100 92 9...

output:

12368

result:

ok answer is '12368'

Test #24:

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

input:

4000 2000
3 9 10 11 15 16 18 19 20 21 25 26 28 29 32 35 36 39 40 41 43 44 53 55 56 59 60 62 65 70 71 72 73 74 1 2 4 75 77 80 85 5 6 7 86 87 8 88 12 89 94 13 96 14 100 101 17 102 22 103 23 24 104 107 27 110 111 30 31 33 112 34 37 38 42 45 46 47 48 49 50 114 51 52 115 54 116 117 119 57 120 121 122 124...

output:

318291867

result:

ok answer is '318291867'

Test #25:

score: 0
Accepted
time: 5ms
memory: 12460kb

input:

4000 2000
2 3 6 8 10 12 13 16 17 19 21 25 26 27 32 35 36 42 43 45 48 51 53 55 56 57 58 59 63 64 65 66 67 73 74 75 76 78 79 80 82 83 85 87 88 89 90 93 94 97 98 100 105 106 107 108 110 111 112 114 118 123 124 128 129 130 1 131 4 133 136 5 7 9 11 14 139 140 15 18 20 22 23 24 28 29 30 31 33 34 142 37 38...

output:

85518659

result:

ok answer is '85518659'

Test #26:

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

input:

4000 2000
1 6 10 12 13 15 16 17 19 20 24 25 27 29 30 31 32 2 3 34 4 36 5 7 39 42 43 44 8 9 45 46 11 48 52 56 14 18 21 22 23 57 26 28 58 33 35 62 37 38 40 41 47 49 50 51 53 67 68 69 71 72 74 76 78 81 54 82 83 84 85 55 59 86 89 60 91 61 92 63 64 93 65 66 94 97 70 98 105 73 75 106 77 107 79 80 87 112 8...

output:

29597070

result:

ok answer is '29597070'

Test #27:

score: 0
Accepted
time: 5ms
memory: 11328kb

input:

5000 2500
1 2 3 7 9 16 17 18 19 21 22 24 27 30 31 32 34 37 39 40 42 43 45 46 47 49 50 55 56 57 58 60 63 64 65 66 70 71 72 74 75 78 79 80 82 84 86 88 90 91 92 93 96 98 99 100 102 104 107 109 112 113 116 117 118 122 123 125 127 131 132 133 136 138 139 140 141 144 146 147 149 150 153 154 157 158 161 16...

output:

398080

result:

ok answer is '398080'

Test #28:

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

input:

5000 2500
1 3 5 7 8 11 12 13 15 18 19 21 25 26 28 30 32 34 36 37 38 39 41 43 44 45 46 50 52 53 54 55 57 58 61 63 64 66 69 72 73 76 77 80 81 83 84 85 87 88 89 90 91 92 94 103 106 107 108 110 112 114 116 119 120 121 126 128 129 131 138 139 140 143 144 146 149 150 151 152 153 155 157 162 163 164 165 16...

output:

108654396

result:

ok answer is '108654396'

Test #29:

score: 0
Accepted
time: 5ms
memory: 12156kb

input:

5000 2500
1 2 4 5 6 7 8 12 13 14 17 22 3 23 9 24 27 10 11 30 15 16 18 31 33 19 20 21 34 37 38 25 26 28 42 29 45 46 47 48 49 50 32 51 52 54 57 35 58 61 36 39 40 63 41 64 43 66 44 53 55 56 67 68 69 76 78 79 59 81 60 82 62 65 83 84 90 70 91 92 71 93 95 97 72 98 99 105 73 106 108 74 109 113 75 118 123 1...

output:

293975703

result:

ok answer is '293975703'

Test #30:

score: 0
Accepted
time: 5ms
memory: 10876kb

input:

5000 2500
2 3 6 8 10 12 13 16 17 19 21 25 26 27 32 35 36 42 43 45 48 51 53 55 56 57 58 59 63 64 65 66 67 73 1 4 74 75 76 78 79 80 82 5 83 85 87 88 7 9 11 14 89 90 93 15 18 94 20 22 97 98 23 100 105 24 28 29 30 31 106 33 107 108 110 34 37 38 39 40 41 44 111 112 46 114 118 47 123 49 124 128 50 129 130...

output:

961199856

result:

ok answer is '961199856'

Test #31:

score: 0
Accepted
time: 3ms
memory: 11460kb

input:

5000 2500
2 3 4 5 7 8 9 11 14 18 21 22 23 26 28 33 35 37 38 40 41 1 6 10 47 49 50 51 53 54 12 13 55 15 16 17 19 20 59 60 24 61 63 64 25 65 27 66 29 70 73 30 31 75 32 34 36 77 39 79 80 87 42 88 90 95 43 96 44 45 99 100 46 48 52 56 57 58 101 102 62 67 68 103 69 71 104 108 109 110 72 74 111 76 78 81 11...

output:

297034581

result:

ok answer is '297034581'

Test #32:

score: 0
Accepted
time: 30ms
memory: 12460kb

input:

5000 2500
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

504674186

result:

ok answer is '504674186'

Test #33:

score: 0
Accepted
time: 34ms
memory: 12148kb

input:

5000 2500
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 87 86 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

294639993

result:

ok answer is '294639993'

Test #34:

score: 0
Accepted
time: 3ms
memory: 11288kb

input:

5000 2500
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

0

result:

ok answer is '0'

Test #35:

score: 0
Accepted
time: 31ms
memory: 11492kb

input:

5000 2500
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

248346497

result:

ok answer is '248346497'

Test #36:

score: 0
Accepted
time: 5ms
memory: 10832kb

input:

5000 4990
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105...

output:

2

result:

ok answer is '2'

Test #37:

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

input:

5000 4999
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

2

result:

ok answer is '2'

Test #38:

score: 0
Accepted
time: 5ms
memory: 10860kb

input:

5000 5000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

0

result:

ok answer is '0'

Test #39:

score: 0
Accepted
time: 26ms
memory: 11832kb

input:

5000 2500
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...

output:

248346497

result:

ok answer is '248346497'