Submission #128694

# Submission time Handle Problem Language Result Execution time Memory
128694 2019-07-11T08:30:36 Z 김세빈(#3158) Fibonacci representations (CEOI18_fib) C++14
5 / 100
8 ms 2040 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll F[22];
ll dp[101010];
ll n, ans;

int main()
{
	ll i, j, a, s;
	
	scanf("%lld", &n);
	
	F[0] = 1, F[1] = 1;
	for(i=2; i<=20; i++){
		F[i] = F[i - 1] + F[i - 2];
	}
	
	dp[0] = 1;
	
	for(i=1; i<=20; i++){
		for(j=100000; j>=F[i]; j--){
			dp[j] = (dp[j] + dp[j - F[i]]) % mod;
		}
	}
	
	for(i=1, s=0; i<=n; i++){
		scanf("%lld", &a); s += F[a];
		printf("%lld\n", dp[s]);
	}
	
	return 0;
}

Compilation message

fib.cpp: In function 'int main()':
fib.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
fib.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a); s += F[a];
   ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 7 ms 1144 KB Output is correct
3 Correct 7 ms 1144 KB Output is correct
4 Correct 7 ms 1144 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 7 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 7 ms 1144 KB Output is correct
3 Correct 7 ms 1144 KB Output is correct
4 Correct 7 ms 1144 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 7 ms 1144 KB Output is correct
7 Correct 7 ms 1144 KB Output is correct
8 Runtime error 8 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 7 ms 1144 KB Output is correct
3 Correct 7 ms 1144 KB Output is correct
4 Correct 7 ms 1144 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 7 ms 1144 KB Output is correct
7 Correct 7 ms 1144 KB Output is correct
8 Runtime error 8 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1144 KB Output is correct
2 Correct 7 ms 1144 KB Output is correct
3 Correct 7 ms 1144 KB Output is correct
4 Correct 7 ms 1144 KB Output is correct
5 Correct 6 ms 1144 KB Output is correct
6 Correct 7 ms 1144 KB Output is correct
7 Correct 7 ms 1144 KB Output is correct
8 Runtime error 8 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -