Submission #10296166
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;
constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
for (auto &u : v) os << u << el;
return (os);
}
template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
for (auto &u : v) is >> u;
return (is);
}
template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
return (is >> p.first >> p.second);
}
int main() {
int N; cin >> N;
set<Pi> ans;
for (int i = 0; i < N; i += 2) {
for (int j = 1; j <= N; j += 3) {
if (j == N) j -= 2;
int p = i+1-(j&1);
if (p < N) ans.emplace(p, j);
}
}
for (int j = 2; j < N; j += 4) {
ans.emplace(1, j);
}
set<Pi> validator;
cout << ans.size() << endl;
for (auto &v : ans) {
cout << v.first << " " << v.second << el;
/*
for (int i = 0; i < 4; i++) {
int ny = v.first + dy[i], nx = v.second + dx[i];
if (ny < 0 || nx < 0 || ny >= N || nx >= N) continue;
validator.emplace(ny, nx);
}
*/
}
/*
if (validator.size() == N*N/2 + (N&1)) {
cout << "OK" << endl;
} else {
cout << "NG" << endl;
}
cout << "validator.size() = " << validator.size() << endl;
*/
return (0);
}
Submission Info
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt |
All |
sample_01.txt, sample_02.txt, sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
subtask1_01.txt |
WA |
3 ms |
640 KB |
subtask1_02.txt |
WA |
1 ms |
256 KB |
subtask1_03.txt |
WA |
7 ms |
1280 KB |
subtask1_04.txt |
WA |
3 ms |
640 KB |
subtask1_05.txt |
WA |
17 ms |
2944 KB |
subtask1_06.txt |
WA |
27 ms |
4736 KB |
subtask1_07.txt |
WA |
5 ms |
896 KB |
subtask1_08.txt |
WA |
29 ms |
5120 KB |
subtask1_09.txt |
WA |
25 ms |
4352 KB |
subtask1_10.txt |
WA |
53 ms |
9216 KB |
subtask1_11.txt |
WA |
52 ms |
8960 KB |
subtask1_12.txt |
WA |
50 ms |
8704 KB |
subtask1_13.txt |
WA |
53 ms |
9088 KB |
subtask1_14.txt |
WA |
51 ms |
8960 KB |
subtask1_15.txt |
WA |
49 ms |
8704 KB |
subtask1_16.txt |
WA |
49 ms |
8576 KB |
subtask1_17.txt |
WA |
49 ms |
8704 KB |
subtask1_18.txt |
WA |
50 ms |
8704 KB |
subtask1_19.txt |
WA |
52 ms |
9088 KB |
subtask1_20.txt |
WA |
54 ms |
9344 KB |