답안 #1013572

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1013572 2024-07-03T16:36:16 Z daffuwu Fancy Fence (CEOI20_fancyfence) C++14
30 / 100
1000 ms 2140 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

long long n, h[100069], w[100069], smw, ans, mn, sm, pv, cur;
const long long dv = 1e9+7;
vector<pair<long long, long long> > vc;

long long calc(long long a, long long b)
{
    if (a%2 == 0) a/=2;
    else b/=2;
    return a%dv*(b%dv)%dv;
}

int main() 
{
    long long i, j, up, dw;
    scanf("%lld", &n);
    for (i=1; i<=n; i++)
    {
        scanf("%lld", h+i);
    }
    for (i=1; i<=n; i++)
    {
        scanf("%lld", w+i);
    }
    for (i=1; i<=n; i++)
    {
        ans += calc(w[i], w[i]+1)*calc(h[i], h[i]+1)%dv;
        ans %= dv;
        mn = h[i];
        for (j=i+1; j<=n; j++)
        {
            mn = min(mn, h[j]);
            ans += w[i]*w[j]%dv*calc(mn, mn+1)%dv;
            ans %= dv;
        }
    }
    printf("%lld\n", ans);  
}

Compilation message

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:20:21: warning: unused variable 'up' [-Wunused-variable]
   20 |     long long i, j, up, dw;
      |                     ^~
fancyfence.cpp:20:25: warning: unused variable 'dw' [-Wunused-variable]
   20 |     long long i, j, up, dw;
      |                         ^~
fancyfence.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     scanf("%lld", &n);
      |     ~~~~~^~~~~~~~~~~~
fancyfence.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%lld", h+i);
      |         ~~~~~^~~~~~~~~~~~~
fancyfence.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%lld", w+i);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Execution timed out 1060 ms 1628 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 447 ms 852 KB Output is correct
3 Execution timed out 1034 ms 2140 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 5 ms 456 KB Output is correct
3 Correct 459 ms 772 KB Output is correct
4 Execution timed out 1062 ms 2140 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 6 ms 856 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 6 ms 480 KB Output is correct
14 Correct 5 ms 348 KB Output is correct
15 Correct 5 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 464 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 5 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Execution timed out 1097 ms 1740 KB Time limit exceeded
12 Halted 0 ms 0 KB -