Submission #536364


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define aLL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXISt(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define MAX 100000000
#define PI 3.14159265258979
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

int sttoi(std::string str) {
	int ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

bool sort_greater(const pair<string, int> &a, const pair<string, int> &b) {
	return a.second > b.second;
}
vector<int> v;

void calc(){
	
}

void solve() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	queue<int> A, B;
	rep(i, n){
		int a;
		cin >> a;
		A.push(a);
	}
	rep(i, m){
		int b;
		cin >> b;
		B.push(b);
	}
	int count = 0;
	int time = 0;
	bool turn = true;//true = A , false = B
	while (true){
		if (turn){
			while (!A.empty() && A.front() < time){
				A.pop();
			}
			if (A.empty()){
				break;
			}
			time = A.front();
			A.pop();
			time += x;
			turn = false;
		}
		else{
			while (!B.empty() && B.front() < time ){
				B.pop();
			}
			if (B.empty()){
				break;
			}
			time = B.front();
			B.pop();
			time += y;
			turn = true;
			count++;
		}
	}
	P(count);
}

int main() {
	solve();
	return 0;
}

Submission Info

Submission Time
Task C - 飛行機乗り
User pantacia1128
Language C++ (GCC 4.9.2)
Score 100
Code Size 2069 Byte
Status AC
Exec Time 153 ms
Memory 1576 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
AC × 3
AC × 18
AC × 33
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
Subtask1 subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt
All subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt, subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt AC 120 ms 1576 KB
subtask0_1.txt AC 83 ms 1180 KB
subtask0_10.txt AC 92 ms 1320 KB
subtask0_11.txt AC 103 ms 1316 KB
subtask0_12.txt AC 108 ms 1444 KB
subtask0_13.txt AC 92 ms 1312 KB
subtask0_14.txt AC 107 ms 1436 KB
subtask0_2.txt AC 98 ms 1308 KB
subtask0_3.txt AC 99 ms 1308 KB
subtask0_4.txt AC 96 ms 1312 KB
subtask0_5.txt AC 82 ms 1192 KB
subtask0_6.txt AC 121 ms 1504 KB
subtask0_7.txt AC 102 ms 1436 KB
subtask0_8.txt AC 82 ms 1188 KB
subtask0_9.txt AC 122 ms 1572 KB
subtask0_sample_01.txt AC 27 ms 804 KB
subtask0_sample_02.txt AC 25 ms 800 KB
subtask0_sample_03.txt AC 27 ms 796 KB
subtask1_0.txt AC 153 ms 1444 KB
subtask1_1.txt AC 143 ms 1436 KB
subtask1_10.txt AC 105 ms 1188 KB
subtask1_11.txt AC 136 ms 1444 KB
subtask1_12.txt AC 149 ms 1440 KB
subtask1_13.txt AC 152 ms 1444 KB
subtask1_14.txt AC 136 ms 1320 KB
subtask1_2.txt AC 144 ms 1448 KB
subtask1_3.txt AC 126 ms 1396 KB
subtask1_4.txt AC 141 ms 1428 KB
subtask1_5.txt AC 138 ms 1448 KB
subtask1_6.txt AC 135 ms 1440 KB
subtask1_7.txt AC 135 ms 1316 KB
subtask1_8.txt AC 139 ms 1436 KB
subtask1_9.txt AC 149 ms 1444 KB