QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#152650#7075. Let's Play Jigsaw Puzzles!PetroTarnavskyi#WA 2ms3568kbC++171.2kb2023-08-28 16:08:402023-08-28 16:08:41

Judging History

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

  • [2023-08-28 16:08:41]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3568kb
  • [2023-08-28 16:08:40]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a) - 1; i >= (b); i++)
#define FILL(a, b) memset(a, b, sizeof(a))

#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;


map<int, int> arr[4];

const int N = 1 << 10;
int ans[N][N];


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int m;
	cin >> m;
	int v = -1;
	FOR(i, 0, m * m)
	{
		VI a(4);
		FOR(j, 0, 4)
			cin >> a[j];
		if(a[0] == -1 && a[2] == -1)
		{
			assert(v == -1);
			v = i + 1;
		}
		FOR(j, 0, 4)
			if(a[j] != -1)
			{
				assert(arr[j].count(a[j]) == 0);
				arr[j][a[j]] = i + 1;
			}
	}
	FOR(i, 0, m)
	{
		if(i == 0) 
		{
			ans[0][0] = v;
		}
		else
		{
			ans[i][0] = arr[0][ans[i - 1][0]];
		}
		
		FOR(j, 1, m)
		{
			ans[i][j] = arr[2][ans[i][j - 1]];	
		}
	}
	FOR(i, 0, m)
	{
		FOR(j, 0, m)
			cout << ans[i][j] << " ";
		cout << endl;
	}
	
	
	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3568kb

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 '