QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#109928 | #6515. Path Planning | yomapeed | WA | 12ms | 3540kb | C++14 | 1.8kb | 2023-05-31 00:02:03 | 2023-05-31 00:02:05 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
/*#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define INF 999999999999999999
#define pb push_back
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
#define ff first
#define ss second
#define printclock cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rand(ll B) { return (unsigned ll)rng() % B;}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
fast;
ll _T = 1;
cin >> _T;
while (_T--) {
ll n, m;
cin >> n >> m;
vector<ll> p(n * m);
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
ll x;
cin >> x;
p[x] = i + j;
}
}
ll ans = 0;
vector<bool> vis(n + m - 1);
for(int i = 0; i < n + m - 1; i++){
if(!vis[p[i]]){
ans++;
}
else{
break;
}
vis[p[i]] = 1;
}
cout << ans << "\n";
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 3488kb
input:
2 2 3 1 2 4 3 0 5 1 5 1 3 0 4 2
output:
3 5
result:
ok 2 number(s): "3 5"
Test #2:
score: -100
Wrong Answer
time: 12ms
memory: 3540kb
input:
10000 2 9 4 0 3 5 2 7 16 11 12 9 13 14 17 10 8 15 1 6 4 8 19 23 22 13 29 4 17 26 30 6 25 3 15 24 18 14 12 8 7 9 27 5 0 10 11 16 31 20 2 28 1 21 1 6 3 2 0 1 4 5 2 3 4 2 0 3 5 1 5 1 4 0 3 2 1 1 3 1 0 2 8 10 9 50 8 0 41 57 60 30 23 65 64 21 36 12 10 5 58 19 38 67 71 52 45 17 77 4 59 51 22 25 56 49 79 2...
output:
9 5 6 3 5 3 14 13 8 9 6 7 6 9 8 4 6 7 13 9 11 10 6 5 6 9 4 2 10 5 18 6 12 3 7 6 9 4 1 5 6 10 8 5 2 7 4 5 8 13 10 10 2 10 3 6 9 9 9 10 4 3 8 5 8 4 7 7 7 9 8 6 6 5 3 7 7 13 3 5 7 7 7 3 10 5 12 7 2 11 6 7 5 11 9 8 3 10 2 7 3 8 7 10 5 4 10 4 6 7 10 4 10 6 4 5 6 4 7 6 8 5 13 7 5 6 8 6 8 3 7 9 4 8 12 4 6 ...
result:
wrong answer 2nd numbers differ - expected: '2', found: '5'