Submission #75672255


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,k,a,b,f;
  cin >> n >> k;
  vector<int> c(n),d(0),e(n);
  
  for(int i=0; i<n; i++) {
    cin >> a;
    c.at(i) = a;
    for(int j=0; j<a; j++) {
      cin >> b;
      d.push_back(b);
    }
  }
  for (int i=0; i<n;i++) {
    cin >> f;
    e.at(i) = f;
  }
  
  int x=d.size(),y,z,sum=0,sumtwo=0;
  for (int i=0; i<n; i++){
    sum += (c.at(i)*e.at(i));
    if(sum>k){
      sum = sumtwo;
      y = i;
      break;
    }
    sumtwo += sum;
  }
  sumtwo = 0;
  for(int i=0; i<y; i++) {
    sumtwo += c.at(i);
  }
  
  z = (x-sum)%c.at(y);
  
  cout << d.at(sumtwo+z-1);
}

Submission Info

Submission Time
Task C - Long Sequence
User Kane218
Language C++23 (GCC 15.2.0)
Score 0
Code Size 678 Byte
Status RE
Exec Time 224 ms
Memory 6244 KiB

Compile Error

./Main.cpp: In function 'main':
./Main.cpp:33:17: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
   33 |   for(int i=0; i<y; i++) {
      |                 ^
./Main.cpp:22:18: note: 'y' was declared here
   22 |   int x=d.size(),y,z,sum=0,sumtwo=0;
      |                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 2
AC × 1
WA × 2
RE × 20
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt
Case Name Status Exec Time Memory
00_sample_00.txt WA 1 ms 3560 KiB
00_sample_01.txt AC 1 ms 3580 KiB
00_sample_02.txt WA 1 ms 3592 KiB
01_random_00.txt RE 103 ms 3656 KiB
01_random_01.txt RE 100 ms 4080 KiB
01_random_02.txt RE 102 ms 3440 KiB
01_random_03.txt RE 100 ms 3940 KiB
01_random_04.txt RE 103 ms 3940 KiB
01_random_05.txt RE 99 ms 3992 KiB
01_random_06.txt RE 99 ms 3608 KiB
01_random_07.txt RE 104 ms 4888 KiB
01_random_08.txt RE 98 ms 3412 KiB
01_random_09.txt RE 103 ms 4388 KiB
01_random_10.txt RE 98 ms 3408 KiB
01_random_11.txt RE 101 ms 3256 KiB
01_random_12.txt RE 155 ms 4744 KiB
01_random_13.txt RE 101 ms 4792 KiB
01_random_14.txt RE 101 ms 4772 KiB
01_random_15.txt RE 224 ms 6244 KiB
01_random_16.txt RE 103 ms 4516 KiB
01_random_17.txt RE 101 ms 4152 KiB
01_random_18.txt RE 99 ms 4096 KiB
01_random_19.txt RE 100 ms 3192 KiB