제출 #1027950

#제출 시각아이디문제언어결과실행 시간메모리
1027950OtalpFlooding Wall (BOI24_wall)C++14
25 / 100
2571 ms790868 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pb push_back #define ff first #define ss second const ll mod = 1e9 + 7; ll dd[500100]; ll a[500100][2]; ll dp[200100]; int ds[10001][20001]; int st[500100]; ll ans = 0; int n; void solve(){ cin>>n; vector<ll> d; for(int k=0; k<2; k++){ for(int i=1; i<=n ; i++){ cin>>a[i][k]; d.pb(a[i][k]); } } st[0] = 1; for(int i=1; i<=n; i++){ st[i] = st[i-1] * 2 % mod; } sort(d.begin(), d.end()); for(int i=0; i<d.size(); i++) ds[n+1][i] = 0, dd[i] = 1; for(int i=n; i>=1; i--){ for(int j=0; j<d.size(); j++){ int asd = 0; for(int k=0; k<2; k++){ if(a[i][k] < d[j]){ asd ++; } } dd[j] = dd[j] * asd % mod; ds[i][j] = (st[n-i+1] - dd[j] + mod) % mod; } } //cout<<"asdasdasd\n"; //for(int i=1; i<=n; i++){ // for(int j=0; j<d.size(); j++){ // cout<<ds[i][j]<<' '; // } // cout<<'\n'; //} ll ans = 0; for(int i=0; i<d.size(); i++) dp[i] = 0, dd[i] = 1; for(int i=1; i<=n; i++){ for(int j=0; j<d.size(); j++){ int asd = 0; for(int k=0; k<2; k++){ if(a[i][k] < d[j]){ asd ++; //cout<<i<<' '<<d[j]<<' '<<a[i][k]<<' '<<dp[j] * (ds[i+1][j]) % mod * (d[j] - d[j-1]) % mod<<'\n'; ans = (ans + dp[j] * ds[i+1][j] % mod * (d[j] - d[j-1]) % mod) % mod; } } dd[j] = dd[j] * asd % mod; dp[j] = (st[i] - dd[j] + mod) % mod; } } cout<<ans; } signed main(){ solve(); }

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

Main.cpp: In function 'void solve()':
Main.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0; i<d.size(); i++) ds[n+1][i] = 0, dd[i] = 1;
      |                  ~^~~~~~~~~
Main.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int j=0; j<d.size(); j++){
      |                      ~^~~~~~~~~
Main.cpp:57:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i=0; i<d.size(); i++) dp[i] = 0, dd[i] = 1;
      |                  ~^~~~~~~~~
Main.cpp:59:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for(int j=0; j<d.size(); j++){
      |                      ~^~~~~~~~~
#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...