QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401366#5528. Least Annoying Constructive Problem2745518585WA 0ms3872kbC++20720b2024-04-28 16:08:492024-04-28 16:08:49

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 16:08:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3872kb
  • [2024-04-28 16:08:49]
  • 提交

answer

#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n;
vector<pair<int,int>> ans;
int main()
{
    scanf("%d",&n);
    if(n%2==1)
    {
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=n/2;++j)
            {
                ans.push_back(make_pair((i-j+n-1)%n+1,(i+j-1)%n+1));
            }
        }
    }
    else
    {
        for(int i=1;i<=n-1;++i)
        {
            ans.push_back(make_pair(i,n));
            for(int j=1;j<=(n-1)/2;++j)
            {
                ans.push_back(make_pair((i-j+(n-1)-1)%(n-1)+1,(i+j-1)%(n-1)+1));
            }
        }
    }
    for(auto i:ans) printf("%d %d\n",i.first,i.second);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3872kb

input:

3

output:

3 2
1 3
2 1

result:

wrong answer Integer 2 violates the range [4, 3]