제출 #1121960

#제출 시각아이디문제언어결과실행 시간메모리
1121960vjudge1Ice Hockey World Championship (CEOI15_bobek)C++11
0 / 100
1114 ms885524 KiB
#include <bits/stdc++.h> #define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long #define itn int #define Int int #define INF -1000000 #define MOD 1000000007 #define endl "\n" #define ff first #define ss second #define all(v) v.begin(), v.end() using namespace std; int temp; signed main() { GOOD_LUCK int t; t = 1; // cin >> t; while (t--) { int n, m, s=0, cnt=0, k=0; cin >> n >> m; vector <int> v; for (int i=0; i < n; i++) { cin >> temp; if (temp < m) { v.push_back(temp); k+=temp; } if (temp == m) s++; } n = v.size(); vector <vector<int>> dp(n+2, vector<int>(n+2, 0)); // 2D: [i][j] --> j-elementli v[i]-in sonda oldugu subarray-deki elementlerin sayi vector <vector<vector<int>>> sums(n+1, vector<vector<int>>(n+1)); // 3D: [i][j][] --> dp[i][j]-deki countlarin her birini alanda alinan sumlari saxlayan 1D vector for (int i=0; i < n; i++) { dp[i][1] = 1; sums[i][1] = {v[i]}; } for (int i=0; i < n; i++) { for (int x=2; x <= i+1; x++) { for (int j=1; j < x; j++) { for (int y : sums[i][j]) { if (y + v[i] <= m) { sums[i][x].push_back(y + v[i]); dp[i][x]++; } } } } } int ans=0; for (int i=0; i < n; i++) { for (int j=1; j<= i+1; j++) { ans += dp[i][j]; cout << i << ' ' << j << ": "; for (int z : sums[i][j]) { cout << z << endl; } cout << endl; } } cout << ans; } return 0; } // Problem B // by Ekber_Ekber

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

bobek.cpp: In function 'int main()':
bobek.cpp:24:21: warning: unused variable 'cnt' [-Wunused-variable]
   24 |      int n, m, s=0, cnt=0, k=0;
      |                     ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...