QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#699082 | #7619. Make SYSU Great Again I | Regina# | WA | 0ms | 3788kb | C++14 | 1.1kb | 2024-11-02 00:51:34 | 2024-11-02 00:51:35 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+10;
int n,k,ni,nj;pair<int,int>a[N*3];
inline int read(){
int r=0,f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar();
return r*f;
}
void put(int x){
if(x<0){putchar('-');x=~x+1;}
if(x>9)put(x/10);
putchar(x%10+'0');
}
signed main(){
// freopen("cpp.in","r",stdin);
// freopen("cpp.out","w",stdout);
n=read(),k=read(),ni=nj=1;
for(int i=1;i<n;i++){
a[3*i-1]=make_pair(i,i);
if(i&1)a[3*i-2]=make_pair(i,n),a[3*i]=make_pair(n,i);
else a[3*i]=make_pair(i,n),a[3*i-2]=make_pair(n,i);
}
for(int i=1;i<=k;i++)
if(i<=3*(n-1))put(a[i].first),printf(" "),put(a[i].second),puts("");
else{
if(ni==n&&nj==n){put(ni),printf(" "),put(nj),puts("");continue;}
while(ni==n||nj==n||ni==nj){
if(++nj>n)nj-=n,ni++;
if(ni==n&&nj==n)break;
}
put(ni),printf(" "),put(nj),puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
3 6
output:
1 3 1 1 3 1 3 2 2 2 2 3
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
3 7
output:
1 3 1 1 3 1 3 2 2 2 2 3 1 2
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
2 4
output:
1 2 1 1 2 1 2 2
result:
ok The answer is correct.
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3788kb
input:
3 9
output:
1 3 1 1 3 1 3 2 2 2 2 3 1 2 1 2 1 2
result:
wrong answer The answer is wrong: Multiple numbers filled in a grid.