답안 #701489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
701489 2023-02-21T11:06:23 Z PCTprobability Fancy Fence (CEOI20_fancyfence) C++17
30 / 100
6 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
int main(){
  ll n;
  cin>>n;
  assert(n<=1000);
  vector<ll> a(n),b(n);
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  ll ans=0;
  for(int i=0;i<n;i++) (ans+=((b[i]*(b[i]+1))/2%mod)*((a[i]*(a[i]+1)/2)%mod))%=mod;
  ans%=mod;
  for(int i=0;i<n;i++){
    ll x=a[i];
    for(int j=i+1;j<n;j++){
      x=min(x,a[j]);
      ans+=(x*(x+1)/2%mod)*b[i]%mod*b[j]%mod;
      ans%=mod;
    }
  }
  cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 5 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 5 ms 212 KB Output is correct
3 Runtime error 1 ms 436 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 212 KB Output is correct
2 Runtime error 1 ms 440 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 312 KB Output is correct
3 Runtime error 1 ms 440 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 332 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 5 ms 212 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 2 ms 304 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 5 ms 336 KB Output is correct
15 Correct 5 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 5 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 5 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 5 ms 304 KB Output is correct
11 Runtime error 1 ms 468 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -