Submission #1120074

#TimeUsernameProblemLanguageResultExecution timeMemory
1120074kitkat12Modsum (NOI12_modsum)C++14
25 / 25
2 ms760 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define F first #define S second #define debug(x) std::cout << #x << ": " << x << "\n" #define all(v) v.begin(), v.end() #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++) #define endl '\n' #define mem(name,val) memset(name,val,sizeof(name)) #define min(a,b) (a<=b ? a : b) #define max(a,b) (a>=b ? a : b) //using u64 = uint64_t; //using u128 = __uint128_t; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; int v[n], w[n]; li(i,0,n) cin>>v[i]>>w[i]; int dp[n][5]; mem(dp,0); li(s,v[0],w[0]+1) dp[0][s%5] ++; li(i,1,n){ li(k,0,5){ li(s,v[i],w[i]+1) dp[i][k] += dp[i-1][(k-s%5+5)%5]; } } ll sum = 0 ; li(i,0,5){ if(i==0) sum += dp[n-1][0]; else if (i == 1||i==4) sum += dp[n-1][i] * 4; else sum += dp[n-1][i] * 5; } cout<<sum; return 0; }

Compilation message (stderr)

modsum.cpp: In function 'int main()':
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:24:5: note: in expansion of macro 'li'
   24 |     li(i,0,n) cin>>v[i]>>w[i];
      |     ^~
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 's' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:27:5: note: in expansion of macro 'li'
   27 |     li(s,v[0],w[0]+1) dp[0][s%5] ++;
      |     ^~
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:29:5: note: in expansion of macro 'li'
   29 |     li(i,1,n){
      |     ^~
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 'k' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:30:9: note: in expansion of macro 'li'
   30 |         li(k,0,5){
      |         ^~
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 's' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:31:13: note: in expansion of macro 'li'
   31 |             li(s,v[i],w[i]+1) dp[i][k] += dp[i-1][(k-s%5+5)%5];
      |             ^~
modsum.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
      |                            ^
modsum.cpp:37:5: note: in expansion of macro 'li'
   37 |     li(i,0,5){
      |     ^~
#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...