QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#179922 | #7240. ABBA | xaphoenix# | WA | 0ms | 3868kb | C++14 | 1.5kb | 2023-09-15 13:29:49 | 2023-09-15 13:29:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repn(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = (n) - 1; i >= a; i--)
#define pern(i, a, n) for (int i = n; i >= a; i--)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef pair<double, double> PDD;
typedef pair<ull, ull> PUU;
typedef pair<LL, LL> PLL;
const int N = 210;
const int M = 1100000;
const int mod = 1e9+7;
const int inf = (int)1e9;
const LL INF = 1e18;
const double eps = 1e-9;
mt19937_64 Rand((unsigned long long)new char);
#define rand Rand
int n, m, ans, pp[N];
double a[N][N];
int main() {
IO;
cin >> n >> m;
repn(i, 1, n) repn(j, 1, m) cin >> a[i][j];
repn(i, 1, n) {
int pos = -1;
repn(j, 1, n) if (abs(a[j][i]) > eps && !pp[j]) {
pos = j;
break;
}
if (pos == -1) continue;
repn(j, 1, n) swap(a[i][j], a[pos][j]);
pp[i] = 1, ans++;
double d = 1.0 / a[i][i];
repn(j, 1, n) a[i][j] *= d;
repn(j, 1, n) if (i != j) {
double coef = a[j][i];
repn(k, 1, n) a[j][k] -= coef * a[i][k];
}
}
cout << ans << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3776kb
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: 3836kb
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: 3816kb
input:
1 1 100
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 2 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 2 1 1 1 2
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3868kb
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: 3848kb
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'