QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#742896 | #7619. Make SYSU Great Again I | threebody1 | WA | 0ms | 3612kb | C++20 | 2.3kb | 2024-11-13 17:35:57 | 2024-11-13 17:36:06 |
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 (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 << endl;
cout << i + 1 << " " << i + 1 << endl;
}
}
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;
}
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 << endl;
cout << i + 1 << " " << i + 1 << 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: 3612kb
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: 3544kb
input:
3 7
output:
1 1 1 2 2 1 2 2 3 3 2 3 3 2
result:
ok The answer is correct.
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3520kb
input:
2 4
output:
1 1 1 2 2 1 2 2
result:
wrong answer The answer is wrong: The maximum common divisor of row 2 and column 1458246784 is not the same.