CoolFace
Datasetpublic

hackercupai/hackercup

Data Preview The data available in this preview contains a 10 row dataset: Sample Dataset ("sample"): This is a subset of the full dataset, containing data from 2023. To view full dataset, download output_dataset.parquet. This contains data from 2011 to 2023. Fields The dataset include the following fields: name (string) year (string) round (string) statement (string) input (string) solution (string) code (string) sample_input (string) sample_output (string)… See the full description on the dataset page: https://huggingface.co/datasets/hackercupai/hackercup.

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
24likes2.2kdownloads
nearly_nim.cpp34 linesDownload Raw Back to finals
1#include <iostream>2#include <vector>3using namespace std;4 5int solve() {6  int N;7  cin >> N;8  vector<int> A(N);9  for (int i = 0; i < N; i++) {10    cin >> A[i];11  }12  int ans = 0;13  vector<int> left(N + 1), right(N + 1);14  for (int i = 0; i < N; i++) {15    left[i + 1] = max(0, A[i] - left[i]);16  }17  for (int i = N - 1; i >= 0; i--) {18    right[i - 1] = max(0, A[i] - right[i]);19  }20  for (int i = 0; i < N; i++) {21    ans += max(0, A[i] - left[i] - right[i]);22  }23  return ans;24}25 26int main() {27  int T;28  cin >> T;29  for (int t = 1; t <= T; t++) {30    cout << "Case #" << t << ": " << solve() << endl;31  }32  return 0;33}34