QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#212609 | #7075. Let's Play Jigsaw Puzzles! | Detach | WA | 0ms | 3592kb | C++17 | 947b | 2023-10-13 18:09:34 | 2023-10-13 18:09:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using i128 = __int128_t;
using PII = pair<int, int>;
const LL LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
void solve()
{
int n;
cin >> n;
int bg;
vector<int> rt(n * n + 1), dw(n * n + 1);
for(int i = 1; i <= n * n; i ++ )
{
bool ok = false;
vector<int> dir(4);
for(int j = 0; j < 4; j ++ ) cin >> dir[j];
if(dir[0] == -1 and dir[2] == -1) bg = i;
rt[i] = dir[3];
dw[i] = dir[1];
}
int ni = bg;
int cnt = 0;
while(ni ^ -1)
{
int nj = ni;
while(nj ^ -1)
{
cout << nj << ' ';
nj = rt[nj];
// cnt ++ ;
// if(cnt > 100) return;
}
ni = dw[ni];
cout << endl;
}
}
int main()
{
int T;
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
input:
2 -1 3 -1 2 -1 4 1 -1 1 -1 -1 4 2 -1 3 -1
output:
1 2 3 4
result:
wrong answer 1st lines differ - expected: '1 2', found: '1 2 '