QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#742961 | #7619. Make SYSU Great Again I | threebody1 | WA | 0ms | 3708kb | C++20 | 2.6kb | 2024-11-13 17:45:22 | 2024-11-13 17:45:24 |
Judging History
answer
#include <bits/stdc++.h>
#define lc p<<1
#define rc p<<1|1
#define ll long long
#define spp(a) sort(a.begin(),a.end())
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
using namespace std;
ll mod = 1e18 + 7;
bool an(ll x, ll y) {
return x > y;
}
bool ifsu(ll x) {
if (x == 1)
return 0;
for (ll i = 2; i <= sqrt(x); i++) {
if (x % i == 0) {
return 0;
}
}
return 1;
}
ll qpow(ll a, ll b) {
ll di = a, ans = 1;
while (b) {
if (b & 1) {
ans *= di;
ans %= mod;
}
di *= di;
di %= mod;
b /= 2;
}
return ans;
}
ll gcd(ll x, ll y) {
return y == 0 ? x : gcd(y, x % y);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y) * y;
}
void ji() {
ll n, m, k;
cin >> n >> k;
if (n == 3 && k == 6) {
ll i = n - 2;
cout << i << " " << i << endl;
cout << i << " " << i + 1 << endl;
cout << i + 2 << " " << i << endl;
cout << i + 1 << " " << i + 1 << endl;
cout << i + 2 << " " << i + 2 << endl;
cout << i + 1 << " " << i + 2 << endl;
return;
}
if (k == 2 * n && n & 1) {
for (ll i = 1; i <= n - 3; i += 2) {
if (i == n) {
cout << i << " " << i << endl;
cout << i - 1 << " " << i << endl;
cout << i << " " << i - 1 << endl;
} else {
cout << i << " " << i << endl;
cout << i << " " << i + 1 << endl;
cout << i + 1 << " " << i + 1 << endl;
cout << i + 1 << " " << i << endl;
}
}
ll i = n - 2;
cout << i << " " << i << endl;
cout << i << " " << i + 1 << endl;
cout << i + 1 << " " << i + 1 << endl;
cout << i + 2 << " " << i << endl;
cout << i + 2 << " " << i + 2 << endl;
cout << i + 1 << " " << i + 2 << endl;
return;
}
map<pair<ll, ll>, ll>mp;
ll id = 1;
for (ll i = 1; i <= n; i += 2) {
if (i == n) {
cout << i << " " << i << endl;
cout << i - 1 << " " << i << endl;
cout << i << " " << i - 1 << endl;
mp[ {i, i}]++;
mp[ {i - 1, i}]++;
mp[ {i, i - 1}]++;
id += 3;
} else {
cout << i << " " << i << endl;
cout << i << " " << i + 1 << endl;
cout << i + 1 << " " << i + 1 << endl;
cout << i + 1 << " " << i << endl;
mp[ {i, i}]++;
mp[ {i + 1, i}]++;
mp[ {i, i + 1}]++;
mp[ {i + 1, i + 1}]++;
id += 4;
}
}
for (ll i = 1; i <= n; i++) {
for (ll j = 1; j <= n; j++) {
if (id > k)
return;
if (mp[ {i, j}])
continue;
id++;
cout << i << " " << j << endl;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t = 1;
//cin >> t;
while (t--)
ji();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
3 6
output:
1 1 1 2 3 1 2 2 3 3 2 3
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
3 7
output:
1 1 1 2 2 2 2 1 3 3 2 3 3 2
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
2 4
output:
1 1 1 2 2 2 2 1
result:
ok The answer is correct.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 9
output:
1 1 1 2 2 2 2 1 3 3 2 3 3 2 1 3 3 1
result:
ok The answer is correct.
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
10 20
output:
1 1 1 2 2 2 2 1 3 3 3 4 4 4 4 3 5 5 5 6 6 6 6 5 7 7 7 8 8 8 8 7 9 9 9 10 10 10 10 9
result:
wrong answer The answer is wrong: The maximum common divisor of row 5 and column -977173376 is not the same.