题解:【ARC225】A - Four Coloring
题解:ARC225 - A
题面:Four Coloring。
解题思路
虽然是道构造题,但是比想象中的要简单。
由于题目中
即:对于任意
最后根据此序列进行输入输出即可,在输入
代码实现
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <atcoder/all>
#define endl '\n'
using namespace std;
typedef long long ll;
int main(int argc, char* argv[]) {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int n; cin >> n;
array<int, 5> res = { 0, 2, 4, 1, 3 }; // res[0] 进行占位
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
int x; cin >> x;
cout << res[x] << ' ';
}
cout << endl;
}
return 0;
}