제출 #1013540

#제출 시각아이디문제언어결과실행 시간메모리
1013540daffuwuFancy Fence (CEOI20_fancyfence)C++14
13 / 100
14 ms3960 KiB
#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; 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]}); ans = calc(sm, sm+1); for (auto [wg, hg]:vc) { if (hg == 2) ans += 2*calc(wg, wg+1); // printf("hg = %lld wg = %lld\n", hg, wg); ans %= dv; } printf("%lld\n", ans); }

컴파일 시 표준 에러 (stderr) 메시지

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:39:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   39 |     for (auto [wg, hg]:vc)
      |               ^
fancyfence.cpp:20:18: warning: unused variable 'j' [-Wunused-variable]
   20 |     long long i, j, up, dw;
      |                  ^
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);
      |         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...