Submission #836536
Source Code Expand
Copy
/* */ //#pragma comment(linker, "/STACK:16777216") #define _CRT_SECURE_NO_WARNINGS #include <fstream> #include <iostream> #include <string> #include <complex> #include <math.h> #include <set> #include <vector> #include <map> #include <queue> #include <stdio.h> #include <stack> #include <algorithm> #include <list> #include <ctime> #include <memory.h> #include <assert.h> #define y0 sdkfaslhagaklsldk #define y1 aasdfasdfasdf #define yn askfhwqriuperikldjk #define j1 assdgsdgasghsf #define tm sdfjahlfasfh #define lr asgasgash #define norm asdfasdgasdgsd #define eps 1e-9 #define M_PI 3.141592653589793 #define bs 1000000007 #define bsize 350 using namespace std; const int INF = 1e9; const int N = 200000; int n, c, a[N], b[N]; long long dp[1000][1000]; long long pw(long long a, long long b) { if (b == 0) return 1; if (b % 2) return a*pw(a, b - 1) % bs; return pw(a*a%bs, b / 2); } int main(){ //freopen("fabro.in","r",stdin); //freopen("fabro.out","w",stdout); //freopen("F:/in.txt", "r", stdin); //freopen("F:/output.txt", "w", stdout); ios_base::sync_with_stdio(0); //cin.tie(0); cin >> n >> c; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n; i++) { cin >> b[i]; } dp[0][0] = 1; for (int i = 0; i < n; i++) { for (int ad = 0; ad <= c; ad++) { long long val = pw(a[i + 1], ad); for (int sum = 0; sum <= c; sum++) { dp[i + 1][sum + ad] += dp[i][sum] * val%bs; dp[i + 1][sum + ad] %= bs; } } } cout << dp[n][c] << endl; cin.get(); cin.get(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Children and Candies |
User | LeBron |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1640 Byte |
Status | WA |
Exec Time | 492 ms |
Memory | 3456 KB |
Compile Error
./Main.cpp:33:0: warning: "M_PI" redefined #define M_PI 3.141592653589793 ^ In file included from /usr/include/c++/5/cmath:44:0, from /usr/include/c++/5/complex:44, from ./Main.cpp:10: /usr/include/math.h:372:0: note: this is the location of the previous definition # define M_PI 3.14159265358979323846 /* pi */ ^
Judge Result
Set Name | Sample | Subtask | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | 0 / 400 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt |
Subtask | 0_001, 0_003, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 2_017.txt, 2_018.txt, 2_019.txt, 2_020.txt, 2_021.txt, 2_022.txt, 2_023.txt, 2_024.txt, 2_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | WA | 4 ms | 256 KB |
0_001.txt | AC | 4 ms | 256 KB |
0_002.txt | WA | 4 ms | 256 KB |
0_003.txt | AC | 4 ms | 256 KB |
0_004.txt | WA | 4 ms | 256 KB |
1_005.txt | AC | 4 ms | 256 KB |
1_006.txt | AC | 4 ms | 256 KB |
1_007.txt | AC | 4 ms | 256 KB |
1_008.txt | AC | 5 ms | 256 KB |
1_009.txt | AC | 5 ms | 256 KB |
1_010.txt | AC | 5 ms | 256 KB |
1_011.txt | AC | 8 ms | 1920 KB |
1_012.txt | AC | 8 ms | 1920 KB |
1_013.txt | AC | 8 ms | 1920 KB |
1_014.txt | AC | 490 ms | 3456 KB |
1_015.txt | AC | 489 ms | 3456 KB |
1_016.txt | AC | 492 ms | 3456 KB |
2_017.txt | WA | 4 ms | 256 KB |
2_018.txt | WA | 4 ms | 256 KB |
2_019.txt | WA | 5 ms | 256 KB |
2_020.txt | WA | 5 ms | 256 KB |
2_021.txt | WA | 8 ms | 1920 KB |
2_022.txt | WA | 8 ms | 1920 KB |
2_023.txt | WA | 492 ms | 3456 KB |
2_024.txt | WA | 489 ms | 3456 KB |
2_025.txt | WA | 89 ms | 2816 KB |
2_026.txt | WA | 9 ms | 1664 KB |
2_027.txt | WA | 392 ms | 3072 KB |
2_028.txt | WA | 12 ms | 896 KB |
2_029.txt | WA | 6 ms | 512 KB |