# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1013556 | 2024-07-03T16:17:01 Z | daffuwu | Fancy Fence (CEOI20_fancyfence) | C++14 | 22 ms | 3928 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); if (i>1 && h[i] != h[i-1]) { vc.push_back({smw, h[i-1]}); smw = 0; } smw += w[i]; sm += w[i]; } vc.push_back({smw, h[n]}); cur = sm; for (auto [wg, hg]:vc) { ans += calc(cur, cur+1)*((calc(hg, hg+1)-calc(pv, pv+1))%dv)%dv; pv = hg; cur -= wg; ans %= dv; } if (ans<0) ans %= dv; printf("%lld\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 444 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 604 KB | Output is correct |
3 | Correct | 8 ms | 2192 KB | Output is correct |
4 | Correct | 16 ms | 3796 KB | Output is correct |
5 | Correct | 22 ms | 3920 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 604 KB | Output is correct |
4 | Correct | 8 ms | 2112 KB | Output is correct |
5 | Correct | 17 ms | 3928 KB | Output is correct |
6 | Correct | 16 ms | 3920 KB | Output is correct |
7 | Incorrect | 1 ms | 348 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |