Submission #582563

# Submission time Handle Problem Language Result Execution time Memory
582563 2022-06-24T05:47:51 Z 반딧불(#8370) Fibonacci representations (CEOI18_fib) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

int n;
ll arr[100002];
ll DP[100002][2]; /// [0]: �� �ű�, [1]: �ű�

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%lld", &arr[i]);
    }
    sort(arr+1, arr+n+1);
    DP[0][0] = 1;
    for(int i=1; i<=n; i++){
        DP[i][0] = (DP[i-1][0] + DP[i-1][1]) % MOD;
        DP[i][1] = (DP[i-1][0] * (arr[i]-arr[i-1]-2)/2 + DP[i-1][1] * (arr[i]-arr[i-1])/2) % MOD;
        printf("%lld\n", (DP[i][0] + DP[i][1]) % MOD);
    }
}

Compilation message

fib.cpp: In function 'int main()':
fib.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
fib.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lld", &arr[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -