QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304205#7178. BishopsNemanjaSo2005WA 83ms5288kbC++14722b2024-01-13 16:33:242024-01-13 16:33:26

Judging History

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

  • [2024-01-13 16:33:26]
  • 评测
  • 测评结果:WA
  • 用时:83ms
  • 内存:5288kb
  • [2024-01-13 16:33:24]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<pair<int,int>> V;
bool flip=false;
int N,M;
int main(){
   cin>>N>>M;
   if(N<M){
      flip=true;
      swap(N,M);
   }
   for(int i=1;i<=M;i++)
      V.push_back({N,i});
   for(int i=2;i<M;i++)
      V.push_back({1,i});
   if(N!=M){
      V.push_back({1,1});
      V.push_back({1,M});
   }
   for(int i=N-M/2-1;i>=M/2+1;i-=2){
      V.push_back({i,M/2+1});
      if(M%2==0)
         V.push_back({i,M/2});
   }
   cout<<V.size()<<endl;
   if(flip)
      for(int i=0;i<V.size();i++)
         swap(V[i].first,V[i].second);
   for(int i=0;i<V.size();i++)
      cout<<V[i].first<<" "<<V[i].second<<endl;
   return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

input:

2 5

output:

6
1 5
2 5
1 1
2 1
2 3
1 3

result:

ok n: 2, m: 5, bishops: 6

Test #2:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

5 5

output:

8
5 1
5 2
5 3
5 4
5 5
1 2
1 3
1 4

result:

ok n: 5, m: 5, bishops: 8

Test #3:

score: 0
Accepted
time: 83ms
memory: 5288kb

input:

100000 100000

output:

199998
100000 1
100000 2
100000 3
100000 4
100000 5
100000 6
100000 7
100000 8
100000 9
100000 10
100000 11
100000 12
100000 13
100000 14
100000 15
100000 16
100000 17
100000 18
100000 19
100000 20
100000 21
100000 22
100000 23
100000 24
100000 25
100000 26
100000 27
100000 28
100000 29
100000 30
10...

result:

ok n: 100000, m: 100000, bishops: 199998

Test #4:

score: -100
Wrong Answer
time: 31ms
memory: 5156kb

input:

100000 99999

output:

199999
100000 1
100000 2
100000 3
100000 4
100000 5
100000 6
100000 7
100000 8
100000 9
100000 10
100000 11
100000 12
100000 13
100000 14
100000 15
100000 16
100000 17
100000 18
100000 19
100000 20
100000 21
100000 22
100000 23
100000 24
100000 25
100000 26
100000 27
100000 28
100000 29
100000 30
10...

result:

wrong answer Sum diagonals are not distinct