AtCoder Beginner Contest 005

Submission #1679509

Source codeソースコード

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

int main(){
	int t, n, m;
	vector<int> a, b;

	int temp;

	cin >> t;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> temp;
		a.push_back(temp);
	}

	cin >> m;

	for (int i = 0; i < m; i++){
		cin >> temp;
		b.push_back(temp);
	}

	if(m>n){
		cout << "no" << endl;
	}else{
		bool s = false;
		int j = 0;

		for (int i = 0; i < m; i++){
			s = false;
			while (j < n)
			{
				if(a[j]-b[i]<=t){
					s = true;
					j++;
					break;
				}else{
					j++;
				}
			}
			if(!s){
				break;
			}
		}

			if (s)
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
	}

}

Submission

Task問題 C - おいしいたこ焼きの売り方
User nameユーザ名 himajin
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 696 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 rand0.txt,rand1.txt,rand10.txt,rand11.txt,rand12.txt,rand13.txt,rand14.txt,rand15.txt,rand16.txt,rand17.txt,rand18.txt,rand19.txt,rand2.txt,rand20.txt,rand21.txt,rand22.txt,rand23.txt,rand24.txt,rand25.txt,rand26.txt,rand27.txt,rand28.txt,rand29.txt,rand3.txt,rand4.txt,rand5.txt,rand6.txt,rand7.txt,rand8.txt,rand9.txt,s1.txt,s2.txt,s3.txt,s4.txt,s5.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
rand0.txt AC 1 ms 256 KB
rand1.txt AC 1 ms 256 KB
rand10.txt AC 1 ms 256 KB
rand11.txt AC 1 ms 256 KB
rand12.txt AC 1 ms 256 KB
rand13.txt WA
rand14.txt WA
rand15.txt AC 1 ms 256 KB
rand16.txt WA
rand17.txt AC 1 ms 256 KB
rand18.txt WA
rand19.txt AC 1 ms 256 KB
rand2.txt AC 1 ms 256 KB
rand20.txt WA
rand21.txt AC 1 ms 256 KB
rand22.txt AC 1 ms 256 KB
rand23.txt AC 1 ms 256 KB
rand24.txt AC 1 ms 256 KB
rand25.txt WA
rand26.txt AC 1 ms 256 KB
rand27.txt WA
rand28.txt AC 1 ms 256 KB
rand29.txt AC 1 ms 256 KB
rand3.txt AC 1 ms 256 KB
rand4.txt AC 1 ms 256 KB
rand5.txt AC 1 ms 256 KB
rand6.txt AC 1 ms 256 KB
rand7.txt AC 1 ms 256 KB
rand8.txt AC 1 ms 256 KB
rand9.txt WA
s1.txt AC 1 ms 256 KB
s2.txt WA
s3.txt AC 1 ms 256 KB
s4.txt WA
s5.txt AC 1 ms 256 KB