Submission #3387639


Source Code Expand

Copy
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int main(){
  long long N, M, K;
  cin >> N;
  vector<double> X(N);
  for(int i = 0; i < N; ++i) cin >> X[i];
  cin >> M >> K;
  vector<int> A(M);
  for(int i = 0; i < M; ++i) cin >> A[i], --A[i];
  vector<double> X_ = X;
  for(int j = 0; j < M; ++j) X_[A[j]] = X_[A[j]+1] + X_[A[j]-1] - X_[A[j]];
  long long T = 1;
  while(X_ != X && T < K){
    for(int j = 0; j < M; ++j) X_[A[j]] = X_[A[j]+1] + X_[A[j]-1] - X_[A[j]];
    ++T;
  }
  if(X_ != X){
    for(int i = 0; i < N; ++i){
      printf("%.12f\n",X_[i]);
    }
    return 0;
  }
  K %= T;
  for(int i = 0; i < K; ++i){
    for(int j = 0; j < M; ++j) X[A[j]] = X[A[j]+1] + X[A[j]-1] - X[A[j]];
  }
  for(int i = 0; i < N; ++i){
    printf("%.12f\n",X[i]);
  }
  return 0;
}

Submission Info

Submission Time
Task C - Rabbit Exercise
User TAB
Language C++14 (GCC 5.4.1)
Score 0
Code Size 844 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 0 / 800 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 145 ms 4096 KB
1_03.txt
1_04.txt
1_05.txt
1_06.txt 269 ms 512 KB
1_07.txt
1_08.txt
1_09.txt
1_10.txt
1_11.txt
1_12.txt 33 ms 256 KB
1_13.txt 375 ms 512 KB
1_14.txt
1_15.txt
1_16.txt 10 ms 512 KB
1_17.txt
1_18.txt
1_19.txt
1_20.txt
1_21.txt
1_22.txt
1_23.txt 177 ms 3584 KB
1_24.txt 97 ms 2688 KB
1_25.txt 82 ms 3712 KB