QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#178032#7240. ABBAPhantomThreshold#WA 0ms3828kbC++20875b2023-09-13 17:33:222023-09-13 17:33:23

Judging History

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

  • [2023-09-13 17:33:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3828kb
  • [2023-09-13 17:33:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int main()
{
	auto poww=[&](long long x,int y)
	{
		long long ret=1;
		while(y)
		{
			if(y&1)ret*=x,ret%=MOD;
			x*=x,x%=MOD;
			y>>=1;
		}
		return ret;
	};
	int n,m;
	cin>>n>>m;
	vector<vector<int>> a(n+5,vector<int>(m+5));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	int r=1;
	for(int i=1;i<=m and r<=n;i++)
	{
		int maxx=0;
		int maxp=r;
		for(int j=r;j<=n;j++)
		{
			if(a[j][i]!=0)
			{
				maxx=a[j][i],maxp=j;
				break;
			}
		}
		if(maxx==0)continue;
		for(int j=i;j<=m;j++)
			swap(a[r][j],a[maxp][j]);
		for(int j=r+1;j<=n;j++)
		{
			long long t=a[j][i]*poww(a[r][i],MOD-2);
			for(int k=i;k<=m;k++)
			{
				a[j][k]=(a[j][k]-t*a[r][k]%MOD+MOD)%MOD;
			}
		}
		r++;
	}
	cout<<r-1<<endl;
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 5
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

3 3
2 0 2
0 2 0
2 0 2

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

1 1
100

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

2 2
1 1
1 1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

2 2
1 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #6:

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

input:

2 3
0 0 0
0 0 0

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

20 20
1149 -158289 421301 -625382 639638 -312855 442515 -223152 -686926 394334 -746085 -488817 -124299 -137253 215418 -120343 632332 845498 -820913 -770155
216423 -11638 -824453 -329865 -799994 166256 164729 -811228 -477642 312149 -570809 -267741 849126 749161 600137 141212 642385 -310587 412930 -22...

output:

20

result:

wrong answer 1st numbers differ - expected: '10', found: '20'