Submission #577524

#TimeUsernameProblemLanguageResultExecution timeMemory
577524juggernautFancy Fence (CEOI20_fancyfence)C++14
30 / 100
1086 ms1216 KiB
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; typedef long long ll; typedef long double ld; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef juggernaut #define printl(args...) printf(args) #else #define printl(args...) 0 #endif int h[100005]; int w[100005]; int n; ll mod=1e9+7; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&h[i]); for(int i=1;i<=n;i++)scanf("%d",&w[i]); ll ans=0; for(int i=1;i<=n;i++){ ll mn=h[i]; ll cn=w[i]; ans+=(((cn*(cn+1)/2ll)%mod)*((mn*(mn+1)/2ll)%mod))%mod; ans%=mod; for(int j=i+1;j<=n;j++){ umin(mn,1ll*h[j]); ll cn2=w[j]; ans+=(((cn*cn2)%mod)*((mn*(mn+1)/2ll)%mod))%mod; ans%=mod; } } cout<<ans; }

Compilation message (stderr)

fancyfence.cpp: In function 'int main()':
fancyfence.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
fancyfence.cpp:26:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  for(int i=1;i<=n;i++)scanf("%d",&h[i]);
      |                       ~~~~~^~~~~~~~~~~~
fancyfence.cpp:27:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |  for(int i=1;i<=n;i++)scanf("%d",&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...