QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304215#7178. BishopsNemanjaSo2005WA 68ms5268kbC++14864b2024-01-13 16:38:502024-01-13 16:38:51

Judging History

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

  • [2024-01-13 16:38:51]
  • 评测
  • 测评结果:WA
  • 用时:68ms
  • 内存:5268kb
  • [2024-01-13 16:38:50]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<pair<int,int>> V;
bool flip=false;
int N,M;
void output(){
   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;
   exit(0);
}
int main(){
   cin>>N>>M;
   if(N<M){
      flip=true;
      swap(N,M);
   }
   if(M==1){
      for(int i=1;i<=N;i++)
         V.push_back({i,1});
      output();
   }
   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});
   }
   output();
   return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

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: 3596kb

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: 67ms
memory: 5172kb

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: 68ms
memory: 5200kb

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: 43ms
memory: 5268kb

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: 0
Accepted
time: 27ms
memory: 4240kb

input:

1 100000

output:

100000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

result:

ok n: 1, m: 100000, bishops: 100000

Test #7:

score: -100
Wrong Answer
time: 47ms
memory: 4136kb

input:

34535 99889

output:

101747
1 99889
2 99889
3 99889
4 99889
5 99889
6 99889
7 99889
8 99889
9 99889
10 99889
11 99889
12 99889
13 99889
14 99889
15 99889
16 99889
17 99889
18 99889
19 99889
20 99889
21 99889
22 99889
23 99889
24 99889
25 99889
26 99889
27 99889
28 99889
29 99889
30 99889
31 99889
32 99889
33 99889
34 99...

result:

wrong answer Participant's answer is not optimal (101747 < 134423)