제출 #1033722

#제출 시각아이디문제언어결과실행 시간메모리
1033722BuiDucManh123Trains (BOI24_trains)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") #define fi first #define se second #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define taskname "" using namespace std; const int mod=1e9+7; const int block=320; ll n,i,a[200009],d[200009],x[200009],f[350][350],ans[200009],res,j,block,r; map<int,int>add[350]; int main() { if (fopen(taskname".inp","r")) { freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(i=1;i<=n;i++){ cin>>d[i]>>x[i]; }ans[1]=1; for(i=1;i<=n;i++){ for(j=1;j<block;j++){ r=i%j; f[j][r]=(f[j][r]+add[j][i]+mod)%mod; ans[i]=(ans[i]+f[j][r]+mod)%mod; } if(d[i]>=block){ if(d[i]>0){ for(j=i+d[i];j<=min(n,i+d[i]*x[i]);j+=d[i]){ ans[j]=(ans[j]+ans[i]+mod)%mod; } } }else{ if(d[i]>0){ f[d[i]][i%d[i]]=(f[d[i]][i%d[i]]+ans[i]+mod)%mod; add[d[i]][i+d[i]*(x[i]+1)]=(add[d[i]][i+d[i]*(x[i]+1)]+ans[i]+mod)%mod; } } }for(i=1;i<=n;i++) res+=ans[i],res%=mod; cout<<(res+mod)%mod; return 0; }

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

Main.cpp:15:68: error: conflicting declaration 'long long int block'
   15 | ll n,i,a[200009],d[200009],x[200009],f[350][350],ans[200009],res,j,block,r;
      |                                                                    ^~~~~
Main.cpp:14:11: note: previous declaration as 'const int block'
   14 | const int block=320;
      |           ^~~~~
Main.cpp: In function 'int main()':
Main.cpp:19:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   freopen(taskname".inp","r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:20:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   freopen(taskname".out","w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~