Submission #8878903
Source Code Expand
/*deco loves Chino*/ #include <bits/stdc++.h> using namespace std; #define int long long int fib[1100]; vector<pair<int,int> > ans[1100]; const int mod=1e9+7; signed main() { fib[0]=fib[1]=1; for(int i=2;i<=90;i++) { fib[i]=fib[i-1]+fib[i-2]; } ans[1].push_back(make_pair(1,2)),ans[1].push_back(make_pair(1,3)); for(int i=1;i<=87;i++) { for(int j=0;j<ans[i].size();j++) { pair<int,int> qwq=ans[i][j]; int dx=qwq.second,dy=qwq.first+dx; while(dy<=fib[i]+fib[i+3]) { ans[i+1].push_back(make_pair(dx,dy)); dy+=dx; } } } int t; cin>>t; while(t--) { int n,m; scanf("%lld%lld",&n,&m); if(n>m) { swap(n,m); } int now=0; while(fib[now+1]<=n&&fib[now+2]<=m) { ++now; } cout<<now<<" "; if(now==1) { cout<<n*m%mod; continue; } int anss=0; for(int i=0;i<ans[now-1].size();i++) { pair<int,int> qwq=ans[now-1][i]; if(qwq.second<=m) { anss+=((n-qwq.first)/qwq.second)%mod; } if(qwq.second<=n) { anss+=((m-qwq.first)/qwq.second)%mod; } anss%=mod; } cout<<anss<<"\n"; } }
Submission Info
Submission Time | |
---|---|
Task | F - Kenus the Ancient Greek |
User | luogu_bot2 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1148 Byte |
Status | RE |
Exec Time | 602 ms |
Memory | 4096 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:34:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld%lld",&n,&m); ^
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1700 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | RE | 97 ms | 384 KB |
02.txt | RE | 97 ms | 384 KB |
03.txt | RE | 97 ms | 384 KB |
04.txt | RE | 96 ms | 384 KB |
05.txt | RE | 97 ms | 384 KB |
06.txt | RE | 96 ms | 384 KB |
07.txt | RE | 97 ms | 384 KB |
08.txt | RE | 96 ms | 384 KB |
09.txt | RE | 96 ms | 384 KB |
10.txt | RE | 98 ms | 384 KB |
11.txt | AC | 602 ms | 2048 KB |
12.txt | AC | 601 ms | 2048 KB |
13.txt | WA | 211 ms | 1920 KB |
14.txt | WA | 211 ms | 1920 KB |
15.txt | WA | 236 ms | 4096 KB |
16.txt | WA | 237 ms | 4096 KB |
17.txt | AC | 136 ms | 3840 KB |
18.txt | AC | 136 ms | 3840 KB |
19.txt | WA | 519 ms | 3584 KB |
20.txt | WA | 519 ms | 3584 KB |
21.txt | RE | 97 ms | 384 KB |
22.txt | AC | 1 ms | 384 KB |
23.txt | WA | 1 ms | 384 KB |
24.txt | AC | 1 ms | 384 KB |
s1.txt | AC | 1 ms | 384 KB |
s2.txt | RE | 96 ms | 384 KB |