Submission #1304500


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int n, m, x, y;
int a[100010], b[100010];

int main(){
cin >> n >> m >> x >> y;
for(int i = 0; i < n; i++){
  cin >> a[i];
}
for(int i = 0; i < m; i++){
  cin >> b[i];
}
int i = 0;//侵食
int j = 0;//侵食
int cnt = 0;//回数
int now = 0;//現在時刻
if(cnt / 2 == 0){
for(int k = i; k < n; k++){
  if(a[k] < now){
    now = a[k] + x;
    cnt++;
    i = k;
    break;
  } 
  if(d == n-1) break;
} else {
  if(int k = j; k < m; k++){
  now = b[k] + y;
  cnt++;
  j = k;
  break;
}
 if(d == n-1) break;
    }
  }
}

cout << cnt/2 << endl;
return 0; 
}

Submission Info

Submission Time
Task A - 勝率計算
User Toufukun
Language C++14 (GCC 5.4.1)
Score 0
Code Size 641 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:6: error: ‘d’ was not declared in this scope
   if(d == n-1) break;
      ^
./Main.cpp:27:3: error: expected ‘}’ before ‘else’
 } else {
   ^
./Main.cpp:28:15: error: expected ‘)’ before ‘;’ token
   if(int k = j; k < m; k++){
               ^
./Main.cpp:28:17: error: ‘k’ was not declared in this scope
   if(int k = j; k < m; k++){
                 ^
./Main.cpp:34:5: error: ‘d’ was not declared in this scope
  if(d == n-1) break;
     ^
./Main.cpp:34:15: error: break statement not within loop or switch
  if(d == n-1) break;
               ^
./Main.cpp: At global scope:
./Main.cpp:37:1: error: expected declaration before ‘}’ token
 }
 ^