Submission #3819844
Source Code Expand
#include <iostream> #include <iomanip> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <stack> #include <queue> #include <bitset> #define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i) #define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define REPC(x,c) for(const auto& x:(c)) #define VS vector<string> #define VL vector<long long> #define VI vector<int> #define VVI vector<vector<int>> #define VVL vector<vector<ll>> #define ALL(x) (x).begin(),(x).end() #define SORT(x) sort(ALL(x)) #define RSORT(x) sort((x).rbegin(),(x).rend()) #define PAIR pair<ll,ll> #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); using ll = long long; constexpr ll MOD = 1000000007; //constexpr ll MOD = 998244353; using std::cout; using std::endl; using std::cin; using std::sort; using std::pair; using std::string; using std::stack; using std::queue; using std::vector; using std::list; using std::map; using std::unordered_map; using std::multimap; using std::unordered_multimap; using std::set; using std::unordered_set; using std::multiset; // ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } // ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // ll pow(ll a, ll b) { ll ans = 1; while (b > 0) { if (b % 2 == 1) { ans *= a; ans %= MOD; }b /= 2; a *= a; a %= MOD; }return ans; } // ll comb(ll n, ll r) { if (n - r < r) { return comb(n, n - r); }static VVL memo = {{1}}; if (memo.size() < n + 1) { memo.reserve(n + 1); FOR(i, memo.size(), n + 1) { memo.emplace_back(i + 1, 0); REP(j, i + 1) { memo[i][j] = 0; if (j < i) { memo[i][j] += memo[i - 1][j]; }if (j > 0) { memo[i][j] += memo[i - 1][j - 1]; }memo[i][j] %= MOD; } } }return memo[n][r]; } // ll comb_L(ll a, ll b) { if (a - b < b) { return comb(a, a - b); }static unordered_map<ll, ll> memo; ll c = 1; FOR(i, a - b + 1, a + 1) { c *= i; c %= MOD; }if (memo.find(b) == memo.end()) { ll k = 1; FOR(i, 2, b + 1) { k *= i; k %= MOD; }memo[b] = pow(k, MOD - 2); } c *= memo[b]; return c % MOD; } // multiset<ll> prime_decomposition(ll n) { ll i = 2; multiset<ll> table{}; while (i * i <= n) { while (n % i == 0) { n /= i; table.emplace(i); }++i; }if (n > 1) { table.emplace(n); return table; }return table; } //-- bit -- REP(i, (1 << n)) {REP(j, n) {cout << (1 & (i >> j));}cout << endl;} //============================================================================================== int main() { ll n, m; cin >> n >> m; if (n < m) { cout << std::min(m - n, (n + 10) - m) << endl; } else { cout << std::min(n - m, (m + 10) - n) << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - 錠 |
User | cutmdo |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 2797 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 0_1.txt, 0_2.txt, 0_3.txt, 0_4.txt, 0_5.txt, 0_6.txt, 0_7.txt, 0_8.txt, 0_9.txt, 1_0.txt, 1_2.txt, 1_3.txt, 1_4.txt, 1_5.txt, 1_6.txt, 1_7.txt, 1_8.txt, 1_9.txt, 2_0.txt, 2_1.txt, 2_3.txt, 2_4.txt, 2_5.txt, 2_6.txt, 2_7.txt, 2_8.txt, 2_9.txt, 3_0.txt, 3_1.txt, 3_2.txt, 3_4.txt, 3_5.txt, 3_6.txt, 3_7.txt, 3_8.txt, 3_9.txt, 4_0.txt, 4_1.txt, 4_2.txt, 4_3.txt, 4_5.txt, 4_6.txt, 4_7.txt, 4_8.txt, 4_9.txt, 5_0.txt, 5_1.txt, 5_2.txt, 5_3.txt, 5_4.txt, 5_6.txt, 5_7.txt, 5_8.txt, 5_9.txt, 6_0.txt, 6_1.txt, 6_2.txt, 6_3.txt, 6_4.txt, 6_5.txt, 6_7.txt, 6_8.txt, 6_9.txt, 7_0.txt, 7_1.txt, 7_2.txt, 7_3.txt, 7_4.txt, 7_5.txt, 7_6.txt, 7_8.txt, 7_9.txt, 8_0.txt, 8_1.txt, 8_2.txt, 8_3.txt, 8_4.txt, 8_5.txt, 8_6.txt, 8_7.txt, 8_9.txt, 9_0.txt, 9_1.txt, 9_2.txt, 9_3.txt, 9_4.txt, 9_5.txt, 9_6.txt, 9_7.txt, 9_8.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_1.txt | AC | 1 ms | 256 KB |
0_2.txt | AC | 1 ms | 256 KB |
0_3.txt | AC | 1 ms | 256 KB |
0_4.txt | AC | 1 ms | 256 KB |
0_5.txt | AC | 1 ms | 256 KB |
0_6.txt | AC | 1 ms | 256 KB |
0_7.txt | AC | 1 ms | 256 KB |
0_8.txt | AC | 1 ms | 256 KB |
0_9.txt | AC | 1 ms | 256 KB |
1_0.txt | AC | 1 ms | 256 KB |
1_2.txt | AC | 1 ms | 256 KB |
1_3.txt | AC | 1 ms | 256 KB |
1_4.txt | AC | 1 ms | 256 KB |
1_5.txt | AC | 1 ms | 256 KB |
1_6.txt | AC | 1 ms | 256 KB |
1_7.txt | AC | 1 ms | 256 KB |
1_8.txt | AC | 1 ms | 256 KB |
1_9.txt | AC | 1 ms | 256 KB |
2_0.txt | AC | 1 ms | 256 KB |
2_1.txt | AC | 1 ms | 256 KB |
2_3.txt | AC | 1 ms | 256 KB |
2_4.txt | AC | 1 ms | 256 KB |
2_5.txt | AC | 1 ms | 256 KB |
2_6.txt | AC | 1 ms | 256 KB |
2_7.txt | AC | 1 ms | 256 KB |
2_8.txt | AC | 2 ms | 256 KB |
2_9.txt | AC | 1 ms | 256 KB |
3_0.txt | AC | 1 ms | 256 KB |
3_1.txt | AC | 1 ms | 256 KB |
3_2.txt | AC | 1 ms | 256 KB |
3_4.txt | AC | 1 ms | 256 KB |
3_5.txt | AC | 1 ms | 256 KB |
3_6.txt | AC | 1 ms | 256 KB |
3_7.txt | AC | 1 ms | 256 KB |
3_8.txt | AC | 1 ms | 256 KB |
3_9.txt | AC | 1 ms | 256 KB |
4_0.txt | AC | 1 ms | 256 KB |
4_1.txt | AC | 1 ms | 256 KB |
4_2.txt | AC | 1 ms | 256 KB |
4_3.txt | AC | 1 ms | 256 KB |
4_5.txt | AC | 1 ms | 256 KB |
4_6.txt | AC | 1 ms | 256 KB |
4_7.txt | AC | 1 ms | 256 KB |
4_8.txt | AC | 1 ms | 256 KB |
4_9.txt | AC | 1 ms | 256 KB |
5_0.txt | AC | 1 ms | 256 KB |
5_1.txt | AC | 1 ms | 256 KB |
5_2.txt | AC | 2 ms | 256 KB |
5_3.txt | AC | 1 ms | 256 KB |
5_4.txt | AC | 1 ms | 256 KB |
5_6.txt | AC | 1 ms | 256 KB |
5_7.txt | AC | 1 ms | 256 KB |
5_8.txt | AC | 1 ms | 256 KB |
5_9.txt | AC | 1 ms | 256 KB |
6_0.txt | AC | 1 ms | 256 KB |
6_1.txt | AC | 1 ms | 256 KB |
6_2.txt | AC | 1 ms | 256 KB |
6_3.txt | AC | 1 ms | 256 KB |
6_4.txt | AC | 1 ms | 256 KB |
6_5.txt | AC | 1 ms | 256 KB |
6_7.txt | AC | 1 ms | 256 KB |
6_8.txt | AC | 1 ms | 256 KB |
6_9.txt | AC | 1 ms | 256 KB |
7_0.txt | AC | 1 ms | 256 KB |
7_1.txt | AC | 1 ms | 256 KB |
7_2.txt | AC | 1 ms | 256 KB |
7_3.txt | AC | 1 ms | 256 KB |
7_4.txt | AC | 1 ms | 256 KB |
7_5.txt | AC | 1 ms | 256 KB |
7_6.txt | AC | 1 ms | 256 KB |
7_8.txt | AC | 1 ms | 256 KB |
7_9.txt | AC | 1 ms | 256 KB |
8_0.txt | AC | 1 ms | 256 KB |
8_1.txt | AC | 1 ms | 256 KB |
8_2.txt | AC | 1 ms | 256 KB |
8_3.txt | AC | 1 ms | 256 KB |
8_4.txt | AC | 1 ms | 256 KB |
8_5.txt | AC | 1 ms | 256 KB |
8_6.txt | AC | 1 ms | 256 KB |
8_7.txt | AC | 1 ms | 256 KB |
8_9.txt | AC | 1 ms | 256 KB |
9_0.txt | AC | 1 ms | 256 KB |
9_1.txt | AC | 1 ms | 256 KB |
9_2.txt | AC | 1 ms | 256 KB |
9_3.txt | AC | 1 ms | 256 KB |
9_4.txt | AC | 1 ms | 256 KB |
9_5.txt | AC | 1 ms | 256 KB |
9_6.txt | AC | 1 ms | 256 KB |
9_7.txt | AC | 1 ms | 256 KB |
9_8.txt | AC | 1 ms | 256 KB |