QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#684354 | #7075. Let's Play Jigsaw Puzzles! | Zhi_zI# | WA | 1ms | 9760kb | C++17 | 1.6kb | 2024-10-28 12:49:23 | 2024-10-28 12:49:24 |
Judging History
answer
#include <bits/stdc++.h>
/* Orther */
#define int long long
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define IOS ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
using namespace std;
/* Pair */
#define x first
#define y second
/* Data type */
using ll = long long;
using ull = unsigned long long;
using PII = pair<int,int>;
using VI = vector<int>;
using VPII = vector<PII>;
/* STL */
#define eb emplace_back
#define ef emplace_front
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define all1(x) x.begin()+1,x.end()
#define sz size
/* Random */
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define random(a,b) rng()%(b-a+1)+a
/* Contest */
const int INF = 0x3f3f3f3f , LLONGMAX = 1e18 ; // 1e9
const int MOD = 998244353 ;
const int N = 2e6 + 10, M = 55;
int u[N], d[N], l[N], r[N];
void Rainbow_()
{
int m; cin >> m ;
for (int i = 1; i <= m * m ; i ++ ) {
int n, s, w, e; // bei nan xi dong
cin >> n >> s >> w >> e;
u[i] = n;
d[i] = s;
l[i] = w;
r[i] = e;
}
int begin = -1 ;
for (int i = 1; i <= m * m; i ++ ) {
if (u[i] == -1 && l[i] == - 1) {
begin = i;
}
}
for (int i = begin; i != -1; i = d[i]) {
for (int j = i; j != -1 ; j = r[j]) {
cout << j << ' ';
} cout << '\n';
}
}
signed main()
{
IOS;
int _ = 1;
// cin >> _;
while ( _ -- )
Rainbow_();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 9760kb
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 '