QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#668627 | #7619. Make SYSU Great Again I | nefugzh | WA | 0ms | 3716kb | C++17 | 2.7kb | 2024-10-23 15:18:22 | 2024-10-23 15:18:29 |
Judging History
answer
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define Mid (l+r)/2
#define Ls i<<1
#define Rs i<<1|1
#define Lson Ls,l,Mid
#define Rson Rs,Mid+1,r
#define For(i,a,b) for(int i=a;i<=b;i++)
#define FOr(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//tree<ll,null_type,std::less<ll>,splay_tree_tag,tree_order_statistics_node_update>sp;//红黑树是rb_tree_tag
/*
inline int read()
{
int x = 0, f = 1; char c = getchar();
while(c < '0' || c > '9') { if(c == '-') f = -f; c = getchar(); }
while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
return x * f;
}
*/
#define maxN 200010
#define M 1000000009
//parameter begin
ll n,k;
ll tmp,nowi,nowj,lasti,lastj;
//parameter end
//function begin
void nextij(ll i,ll j)
{
return ;
}
//function end
void solve()
{
cin>>n>>k;
tmp=0,nowi=1,nowj=1;
For(i,1,2*n-1)
{
if(i%4==1) nowi=nowj=1+tmp;
else if(i%4==2) nowi=1+tmp,nowj=n-tmp;
else if(i%4==3) nowi=nowj=n-tmp;
else if(i%4==0)
{
nowi=n-tmp;
tmp++;
nowj=1+tmp;
}
cout<<nowi<<" "<<nowj<<endl;
}
lasti=nowi,lastj=nowj-1;
cout<<lasti<<" "<<lastj<<endl;
if(k==2*n) return;
tmp=2*n;
if(n&1)
For(i,1,n)
For(j,1,n)
{
if(i==j) continue;
else if(i==lasti&&j==lastj) continue;
else if( i<=(n/2) && j>(n/2+1) && i==n+1-j ) continue;
else if( i>(n/2) && j<=(n/2+1) && i==n+1-j+1 ) continue;
else
{
tmp++;
cout<<i<<" "<<j<<endl;
if(tmp==k) return;
}
}
else
For(i,1,n)
For(j,1,n)
{
if(i==j) continue;
else if(i==lasti&&j==lastj) continue;
else if( i<=(n/2) && j>(n/2) && i==n+1-j ) continue;
else if( i>(n/2) && j<=(n/2) && i==n+1-j+1 ) continue;
else
{
tmp++;
cout<<i<<" "<<j<<endl;
if(tmp==k) return;
}
}
return ;
}
int main ()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll T;
T=1;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
3 6
output:
1 1 1 3 3 3 3 2 2 2 2 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
3 7
output:
1 1 1 3 3 3 3 2 2 2 2 1 1 2
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3648kb
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: 3620kb
input:
3 9
output:
1 1 1 3 3 3 3 2 2 2 2 1 1 2 2 3 3 1
result:
ok The answer is correct.
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3716kb
input:
10 20
output:
1 1 1 10 10 10 10 2 2 2 2 9 9 9 9 3 3 3 3 8 8 8 8 4 4 4 4 7 7 7 7 5 5 5 5 6 6 6 6 5
result:
wrong answer The answer is wrong: There are fewer than two numbers in one row or column