Submission #12893803


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














string S, T;
//---------------------------------------------------------------------------------------------------
vector<string> floors;
int f(string s) {
	rep(i, 0, 18) if (floors[i] == s) return i;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> S >> T;

	rrep(i, 9, 1) floors.push_back("B" + to_string(i));
	rep(i, 1, 10) floors.push_back(to_string(i) + "F");

	int s = f(S);
	int t = f(T);

	int ans = abs(s - t);
	cout << ans << endl;
}





Submission Info

Submission Time
Task A - Elevator
User hamayanhamayan
Language C++ (GCC 9.2.1)
Score 9
Code Size 1828 Byte
Status AC
Exec Time 2 ms
Memory 3724 KB

Compile Error

./Main.cpp: In function ‘int f(std::string)’:
./Main.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^

Judge Result

Set Name All
Score / Max Score 9 / 9
Status
AC × 22
Set Name Test Cases
All 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
0.txt AC 2 ms 3632 KB
1.txt AC 2 ms 3704 KB
10.txt AC 2 ms 3644 KB
11.txt AC 2 ms 3576 KB
12.txt AC 2 ms 3636 KB
13.txt AC 2 ms 3588 KB
14.txt AC 2 ms 3656 KB
15.txt AC 2 ms 3712 KB
16.txt AC 2 ms 3636 KB
17.txt AC 2 ms 3636 KB
2.txt AC 2 ms 3652 KB
3.txt AC 2 ms 3564 KB
4.txt AC 2 ms 3684 KB
5.txt AC 2 ms 3644 KB
6.txt AC 2 ms 3652 KB
7.txt AC 2 ms 3584 KB
8.txt AC 2 ms 3668 KB
9.txt AC 2 ms 3724 KB
s1.txt AC 2 ms 3588 KB
s2.txt AC 2 ms 3628 KB
s3.txt AC 2 ms 3636 KB
s4.txt AC 2 ms 3648 KB