QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#29372 | #2062. Fibonacci Equation | sinbad# | AC ✓ | 6ms | 3712kb | C++ | 4.3kb | 2022-04-17 15:55:00 | 2022-04-28 14:44:43 |
Judging History
answer
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const multiset<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
template <class T> auto vect(const T& v, int n) { return vector<T>(n, v); }
template <class T, class... D> auto vect(const T& v, int n, D... m) {
return vector<decltype(vect(v, m...))>(n, vect(v, m...));
}
using int64 = long long;
using int128 = __int128_t;
using ii = pair<int, int>;
#define SZ(x) (int)((x).size())
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
// mt19937 mrand(random_device{}());
// int rnd(int x) { return mrand() % x; }
mt19937_64 mrand(random_device{}());
int64 rnd(int64 x) { return mrand() % x; }
int lg2(int64 x) { return sizeof(int64) * 8 - 1 - __builtin_clzll(x); }
template <class T> void out(const vector<T>& a) { for (int i = 0; i < SZ(a); ++i) cout << a[i] << " \n"[i + 1 == SZ(a)]; }
template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template <class T> void dedup(vector<T>& v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); }
void add_mod(int& x, int y) { x += y; if (x >= MOD) x -= MOD; }
void sub_mod(int& x, int y) { x += MOD - y; if (x >= MOD) x -= MOD; }
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
};
} fast_ios_;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a == 0) {
cout << 1 << '\n';
return 0;
}
if (b == 1 && a + c == 2) {
cout << 2 << '\n';
return 0;
}
if (b > a && b > c) {
if (b == 3) {
cout << 1 << '\n';
} else {
cout << 2 << '\n';
}
} else {
cout << 0 << '\n';
}
// vector<int128> F(20);
// F[0] = 0; F[1] = 1;
// for (int i = 2; i < 20; ++i) F[i] = F[i - 1] + F[i - 2];
// for (int i = 1; i < 19; ++i) {
// int128 cur = F[i] * F[i] - 4 * F[i - 1] * F[i + 1];
// trace(i, cur > 0, cur == 0);
// }
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3644kb
input:
1 2 0
output:
2
result:
ok answer is '2'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
1 0 2
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3648kb
input:
52373 52374 52372
output:
2
result:
ok answer is '2'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
50443 50445 50444
output:
2
result:
ok answer is '2'
Test #5:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
48514 48513 48515
output:
0
result:
ok answer is '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
46583 46584 46585
output:
0
result:
ok answer is '0'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
13978 13977 13976
output:
0
result:
ok answer is '0'
Test #8:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
4294 4293 4292
output:
0
result:
ok answer is '0'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
2363 2364 2362
output:
2
result:
ok answer is '2'
Test #10:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
69747 69746 69748
output:
0
result:
ok answer is '0'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3648kb
input:
67818 67816 67817
output:
0
result:
ok answer is '0'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
92322 92323 92321
output:
2
result:
ok answer is '2'
Test #13:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
5842 5844 5843
output:
2
result:
ok answer is '2'
Test #14:
score: 0
Accepted
time: 3ms
memory: 3708kb
input:
50030 50031 50032
output:
0
result:
ok answer is '0'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3704kb
input:
48100 48101 48102
output:
0
result:
ok answer is '0'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
46172 46171 46170
output:
0
result:
ok answer is '0'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
13566 13565 13564
output:
0
result:
ok answer is '0'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
11635 11636 11634
output:
2
result:
ok answer is '2'
Test #19:
score: 0
Accepted
time: 3ms
memory: 3564kb
input:
1951 1949 1950
output:
0
result:
ok answer is '0'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
69333 69334 69335
output:
0
result:
ok answer is '0'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
67404 67406 67405
output:
2
result:
ok answer is '2'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
52467 52468 52466
output:
2
result:
ok answer is '2'
Test #23:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
701041165 701041167 701041166
output:
2
result:
ok answer is '2'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
175744381 175744383 175744382
output:
2
result:
ok answer is '2'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
60512987 60512988 60512989
output:
0
result:
ok answer is '0'
Test #26:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
240248897 240248898 240248899
output:
0
result:
ok answer is '0'
Test #27:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
125017505 125017503 125017504
output:
0
result:
ok answer is '0'
Test #28:
score: 0
Accepted
time: 3ms
memory: 3556kb
input:
599720717 599720719 599720718
output:
2
result:
ok answer is '2'
Test #29:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
484489324 484489325 484489323
output:
2
result:
ok answer is '2'
Test #30:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
369257930 369257929 369257931
output:
0
result:
ok answer is '0'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
548993840 548993839 548993841
output:
0
result:
ok answer is '0'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
795065278 795065277 795065276
output:
0
result:
ok answer is '0'
Test #33:
score: 0
Accepted
time: 4ms
memory: 3568kb
input:
439053636 439053637 439053635
output:
2
result:
ok answer is '2'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
477807979 477807977 477807978
output:
0
result:
ok answer is '0'
Test #35:
score: 0
Accepted
time: 2ms
memory: 3572kb
input:
516562319 516562318 516562320
output:
0
result:
ok answer is '0'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
555316660 555316661 555316662
output:
0
result:
ok answer is '0'
Test #37:
score: 0
Accepted
time: 3ms
memory: 3544kb
input:
772033420 772033418 772033419
output:
0
result:
ok answer is '0'
Test #38:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
810787761 810787762 810787760
output:
2
result:
ok answer is '2'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
849542103 849542102 849542101
output:
0
result:
ok answer is '0'
Test #40:
score: 0
Accepted
time: 3ms
memory: 3500kb
input:
888296445 888296444 888296443
output:
0
result:
ok answer is '0'
Test #41:
score: 0
Accepted
time: 3ms
memory: 3552kb
input:
631683487 631683486 631683485
output:
0
result:
ok answer is '0'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
646701821 646701820 646701819
output:
0
result:
ok answer is '0'
Test #43:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
390088862 390088861 390088860
output:
0
result:
ok answer is '0'
Test #44:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
428843203 428843204 428843202
output:
2
result:
ok answer is '2'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
645559961 645559962 645559960
output:
2
result:
ok answer is '2'
Test #46:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
684314304 684314303 684314302
output:
0
result:
ok answer is '0'
Test #47:
score: 0
Accepted
time: 6ms
memory: 3544kb
input:
427701343 427701344 427701345
output:
0
result:
ok answer is '0'
Test #48:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
761822987 761822985 761822986
output:
0
result:
ok answer is '0'
Test #49:
score: 0
Accepted
time: 3ms
memory: 3696kb
input:
800577328 800577327 800577329
output:
0
result:
ok answer is '0'
Test #50:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
17394088 17394086 17394087
output:
0
result:
ok answer is '0'
Test #51:
score: 0
Accepted
time: 3ms
memory: 3528kb
input:
56148429 56148428 56148427
output:
0
result:
ok answer is '0'
Test #52:
score: 0
Accepted
time: 3ms
memory: 3552kb
input:
925650895 925650894 925650896
output:
0
result:
ok answer is '0'
Test #53:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
0 1 2
output:
1
result:
ok answer is '1'
Test #54:
score: 0
Accepted
time: 3ms
memory: 3556kb
input:
0 2 1
output:
1
result:
ok answer is '1'
Test #55:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
1 0 2
output:
0
result:
ok answer is '0'
Test #56:
score: 0
Accepted
time: 3ms
memory: 3500kb
input:
1 2 0
output:
2
result:
ok answer is '2'
Test #57:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
2 0 1
output:
0
result:
ok answer is '0'
Test #58:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
2 1 0
output:
2
result:
ok answer is '2'
Test #59:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
1 2 3
output:
0
result:
ok answer is '0'
Test #60:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
1 3 2
output:
1
result:
ok answer is '1'
Test #61:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
2 1 3
output:
0
result:
ok answer is '0'
Test #62:
score: 0
Accepted
time: 3ms
memory: 3572kb
input:
2 3 1
output:
1
result:
ok answer is '1'
Test #63:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
3 1 2
output:
0
result:
ok answer is '0'
Test #64:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
3 2 1
output:
0
result:
ok answer is '0'
Test #65:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
2 3 4
output:
0
result:
ok answer is '0'
Test #66:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
2 4 3
output:
2
result:
ok answer is '2'
Test #67:
score: 0
Accepted
time: 3ms
memory: 3552kb
input:
3 2 4
output:
0
result:
ok answer is '0'
Test #68:
score: 0
Accepted
time: 2ms
memory: 3604kb
input:
3 4 2
output:
2
result:
ok answer is '2'
Test #69:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
4 2 3
output:
0
result:
ok answer is '0'
Test #70:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
4 3 2
output:
0
result:
ok answer is '0'
Test #71:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
3 4 5
output:
0
result:
ok answer is '0'
Test #72:
score: 0
Accepted
time: 3ms
memory: 3700kb
input:
3 5 4
output:
2
result:
ok answer is '2'
Test #73:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
4 3 5
output:
0
result:
ok answer is '0'
Test #74:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
4 5 3
output:
2
result:
ok answer is '2'
Test #75:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
5 3 4
output:
0
result:
ok answer is '0'
Test #76:
score: 0
Accepted
time: 3ms
memory: 3532kb
input:
5 4 3
output:
0
result:
ok answer is '0'
Test #77:
score: 0
Accepted
time: 3ms
memory: 3556kb
input:
10 11 12
output:
0
result:
ok answer is '0'
Test #78:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
10 12 11
output:
2
result:
ok answer is '2'
Test #79:
score: 0
Accepted
time: 3ms
memory: 3712kb
input:
11 10 12
output:
0
result:
ok answer is '0'
Test #80:
score: 0
Accepted
time: 3ms
memory: 3556kb
input:
11 12 10
output:
2
result:
ok answer is '2'
Test #81:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
12 10 11
output:
0
result:
ok answer is '0'
Test #82:
score: 0
Accepted
time: 3ms
memory: 3556kb
input:
12 11 10
output:
0
result:
ok answer is '0'
Test #83:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
11 12 13
output:
0
result:
ok answer is '0'
Test #84:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
11 13 12
output:
2
result:
ok answer is '2'
Test #85:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
12 11 13
output:
0
result:
ok answer is '0'
Test #86:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
12 13 11
output:
2
result:
ok answer is '2'
Test #87:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
13 11 12
output:
0
result:
ok answer is '0'
Test #88:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
13 12 11
output:
0
result:
ok answer is '0'
Test #89:
score: 0
Accepted
time: 3ms
memory: 3508kb
input:
12 13 14
output:
0
result:
ok answer is '0'
Test #90:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
12 14 13
output:
2
result:
ok answer is '2'
Test #91:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
13 12 14
output:
0
result:
ok answer is '0'
Test #92:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
13 14 12
output:
2
result:
ok answer is '2'
Test #93:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
14 12 13
output:
0
result:
ok answer is '0'
Test #94:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
14 13 12
output:
0
result:
ok answer is '0'
Test #95:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
999999998 999999999 1000000000
output:
0
result:
ok answer is '0'
Test #96:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
999999998 1000000000 999999999
output:
2
result:
ok answer is '2'
Test #97:
score: 0
Accepted
time: 3ms
memory: 3704kb
input:
999999999 999999998 1000000000
output:
0
result:
ok answer is '0'
Test #98:
score: 0
Accepted
time: 3ms
memory: 3696kb
input:
999999999 1000000000 999999998
output:
2
result:
ok answer is '2'
Test #99:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
1000000000 999999998 999999999
output:
0
result:
ok answer is '0'
Test #100:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
1000000000 999999999 999999998
output:
0
result:
ok answer is '0'