QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189481#2869. Anno Domini 2022triplem5ds#AC ✓1ms3556kbC++231.3kb2023-09-27 15:53:262023-09-27 15:53:27

Judging History

This is the latest submission verdict.

  • [2023-09-27 15:53:27]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3556kb
  • [2023-09-27 15:53:26]
  • Submitted

answer

/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;

const int N = 5e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;

void doWork() {
    string s1, s2;
    string s3, s4;
    cin >> s1 >> s2 >> s3 >> s4;
    if (s1 == "AD" && s3 == "AD") {
        cout << abs(stoi(s2) - stoi(s4)) << '\n';
    } else if (s2 == "BC" && s4 == "BC") {
        cout << abs(stoi(s1) - stoi(s3)) << '\n';
    } else {
        if (s2 == "BC") {
            cout << stoi(s1) + stoi(s4) - 1 << '\n';
        } else {
            cout << stoi(s2) + stoi(s3) - 1 << '\n';
        }
    }
}

int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
//    cin >> t;
    while (t--) {
        doWork();
    }
}

详细

Test #1:

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

input:

1 BC
AD 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

AD 1
AD 2001

output:

2000

result:

ok single line: '2000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

AD 2022
5508 BC

output:

7529

result:

ok single line: '7529'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3404kb

input:

1 BC
1 BC

output:

0

result:

ok single line: '0'

Test #5:

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

input:

1 BC
2 BC

output:

1

result:

ok single line: '1'

Test #6:

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

input:

1 BC
AD 2

output:

2

result:

ok single line: '2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

2 BC
1 BC

output:

1

result:

ok single line: '1'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

2 BC
2 BC

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

2 BC
AD 1

output:

2

result:

ok single line: '2'

Test #10:

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

input:

2 BC
AD 2

output:

3

result:

ok single line: '3'

Test #11:

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

input:

AD 1
1 BC

output:

1

result:

ok single line: '1'

Test #12:

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

input:

AD 1
2 BC

output:

2

result:

ok single line: '2'

Test #13:

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

input:

AD 1
AD 1

output:

0

result:

ok single line: '0'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

AD 1
AD 2

output:

1

result:

ok single line: '1'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

AD 2
1 BC

output:

2

result:

ok single line: '2'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

AD 2
2 BC

output:

3

result:

ok single line: '3'

Test #17:

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

input:

AD 2
AD 1

output:

1

result:

ok single line: '1'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

AD 2
AD 2

output:

0

result:

ok single line: '0'

Test #19:

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

input:

1 BC
9999 BC

output:

9998

result:

ok single line: '9998'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

1 BC
AD 9999

output:

9999

result:

ok single line: '9999'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

AD 1
9999 BC

output:

9999

result:

ok single line: '9999'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

AD 1
AD 9999

output:

9998

result:

ok single line: '9998'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

9999 BC
1 BC

output:

9998

result:

ok single line: '9998'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3408kb

input:

9999 BC
AD 1

output:

9999

result:

ok single line: '9999'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

9999 BC
9999 BC

output:

0

result:

ok single line: '0'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3460kb

input:

9999 BC
AD 9999

output:

19997

result:

ok single line: '19997'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

AD 9999
1 BC

output:

9999

result:

ok single line: '9999'

Test #28:

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

input:

AD 9999
AD 1

output:

9998

result:

ok single line: '9998'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

AD 9999
9999 BC

output:

19997

result:

ok single line: '19997'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

AD 9999
AD 9999

output:

0

result:

ok single line: '0'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

AD 1
5 BC

output:

5

result:

ok single line: '5'

Test #32:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

AD 1
AD 60

output:

59

result:

ok single line: '59'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

AD 1
701 BC

output:

701

result:

ok single line: '701'

Test #34:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

AD 1
AD 8001

output:

8000

result:

ok single line: '8000'

Test #35:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

20 BC
5 BC

output:

15

result:

ok single line: '15'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

20 BC
AD 60

output:

79

result:

ok single line: '79'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

20 BC
701 BC

output:

681

result:

ok single line: '681'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

20 BC
AD 8001

output:

8020

result:

ok single line: '8020'

Test #39:

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

input:

AD 301
5 BC

output:

305

result:

ok single line: '305'

Test #40:

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

input:

AD 301
AD 60

output:

241

result:

ok single line: '241'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

AD 301
701 BC

output:

1001

result:

ok single line: '1001'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

AD 301
AD 8001

output:

7700

result:

ok single line: '7700'

Test #43:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

4001 BC
5 BC

output:

3996

result:

ok single line: '3996'

Test #44:

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

input:

4001 BC
AD 60

output:

4060

result:

ok single line: '4060'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

4001 BC
701 BC

output:

3300

result:

ok single line: '3300'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

4001 BC
AD 8001

output:

12001

result:

ok single line: '12001'

Test #47:

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

input:

AD 8176
5990 BC

output:

14165

result:

ok single line: '14165'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

6280 BC
AD 3823

output:

10102

result:

ok single line: '10102'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

AD 6284
AD 8116

output:

1832

result:

ok single line: '1832'

Test #50:

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

input:

7706 BC
6637 BC

output:

1069

result:

ok single line: '1069'

Test #51:

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

input:

1944 BC
6856 BC

output:

4912

result:

ok single line: '4912'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

AD 3124
AD 3215

output:

91

result:

ok single line: '91'

Test #53:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

5502 BC
AD 6301

output:

11802

result:

ok single line: '11802'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

597 BC
5108 BC

output:

4511

result:

ok single line: '4511'

Test #55:

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

input:

5809 BC
5560 BC

output:

249

result:

ok single line: '249'

Test #56:

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

input:

7133 BC
AD 8788

output:

15920

result:

ok single line: '15920'

Test #57:

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

input:

8341 BC
114 BC

output:

8227

result:

ok single line: '8227'

Test #58:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

AD 7616
AD 2145

output:

5471

result:

ok single line: '5471'

Test #59:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

AD 323
6573 BC

output:

6895

result:

ok single line: '6895'

Test #60:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

AD 4972
AD 4711

output:

261

result:

ok single line: '261'

Test #61:

score: 0
Accepted
time: 0ms
memory: 3460kb

input:

AD 2296
4913 BC

output:

7208

result:

ok single line: '7208'

Test #62:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

AD 2479
5935 BC

output:

8413

result:

ok single line: '8413'

Test #63:

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

input:

3418 BC
AD 7324

output:

10741

result:

ok single line: '10741'

Test #64:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

2563 BC
4362 BC

output:

1799

result:

ok single line: '1799'

Test #65:

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

input:

7274 BC
7994 BC

output:

720

result:

ok single line: '720'

Test #66:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

8867 BC
AD 6424

output:

15290

result:

ok single line: '15290'

Test #67:

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

input:

AD 577
199 BC

output:

775

result:

ok single line: '775'

Test #68:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

AD 4828
469 BC

output:

5296

result:

ok single line: '5296'

Test #69:

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

input:

AD 6161
9199 BC

output:

15359

result:

ok single line: '15359'

Test #70:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

AD 6807
6676 BC

output:

13482

result:

ok single line: '13482'

Test #71:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

1325 BC
AD 3158

output:

4482

result:

ok single line: '4482'

Test #72:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

AD 168
AD 1810

output:

1642

result:

ok single line: '1642'

Test #73:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

43 BC
AD 3854

output:

3896

result:

ok single line: '3896'

Test #74:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

AD 9591
AD 8611

output:

980

result:

ok single line: '980'

Test #75:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

AD 9945
AD 9604

output:

341

result:

ok single line: '341'

Test #76:

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

input:

AD 5309
8072 BC

output:

13380

result:

ok single line: '13380'