QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304211#7178. BishopsNemanjaSo2005WA 60ms5272kbC++14722b2024-01-13 16:37:062024-01-13 16:37:06

Judging History

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

  • [2024-01-13 16:37:06]
  • 评测
  • 测评结果:WA
  • 用时:60ms
  • 内存:5272kb
  • [2024-01-13 16:37:06]
  • 提交

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+2;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: 0ms
memory: 3516kb

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: 0ms
memory: 3592kb

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: 59ms
memory: 5184kb

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: 0
Accepted
time: 60ms
memory: 5272kb

input:

100000 99999

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: 99999, bishops: 199998

Test #5:

score: 0
Accepted
time: 28ms
memory: 5188kb

input:

100000 50000

output:

149998
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: 50000, bishops: 149998

Test #6:

score: -100
Wrong Answer
time: 15ms
memory: 3740kb

input:

1 100000

output:

50002
1 100000
1 1
1 1
1 99999
1 99997
1 99995
1 99993
1 99991
1 99989
1 99987
1 99985
1 99983
1 99981
1 99979
1 99977
1 99975
1 99973
1 99971
1 99969
1 99967
1 99965
1 99963
1 99961
1 99959
1 99957
1 99955
1 99953
1 99951
1 99949
1 99947
1 99945
1 99943
1 99941
1 99939
1 99937
1 99935
1 99933
1 999...

result:

wrong answer Sum diagonals are not distinct