Submission #149047


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pLl;
typedef pair<ull,ull> pUll;

#define FOR(i,fi,co) for(int i=fi;i<co;i++)
#define rep(i,co) FOR(i,0,co)
#ifndef _DEBUG
	#define repI(x,a) for(__typeof(a.begin()) x=a.begin();x!=a.end();x++)
#else
	#define repI(x,a) for(decltype(a.begin()) x=a.begin();x!=a.end();x++)
#endif
#define all(a) (a).begin(), (a).end()
#define mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define zero(a) memset(a,0,sizeof(a))
void _fillInt(int* p,int val,int rep){rep(i,rep)p[i]=val;}
#define fillInt(a,val) _fillInt((int*)a,val,sizeof(a)/sizeof(int)

template <class T>T sqr(T val){return val*val;}

#define _usescanf

void answer(){
	int tako[100],cos[100],t,n,m;
	cin >> t >> n;
	
	rep(i,n){
		cin >> tako[i];
	}

	cin >> m;

	rep(i,m){
		cin >> cos[i];
	}
	
	int *ptako = tako,*pcos = cos;

	while(--pcos != &(cos[m])){
		pcos++;
		if(--ptako == &(tako[n])){
			cout << "no" << endl;
			return;
		}
		if(*ptako > *pcos){
			cout << "no" << endl;
			return;
		}
		if(*pcos - *ptako <= t){
			ptako++,pcos++;
		}
		else{
			ptako++;
		}
	}

	cout << "yes" << endl;
}


int main(int argc,char**arcv){
#ifdef _DEBUG
	freopen("in.txt","r",stdin);
	freopen("answer.txt","w",stdout);
	ios::sync_with_stdio(false);
	int n;
#ifdef usescanf
	scanf("%d",&n);
#else
	cin >> n;
#endif
	rep(i,n){
		answer();
		cout << '\n';
	}
	fclose(stdin);
	fclose(stdout);
#else
	ios::sync_with_stdio(false);
	answer();
#endif
	return 0;
}

Submission Info

Submission Time
Task C - おいしいたこ焼きの売り方
User hakoai
Language C++ (G++ 4.6.4)
Score 0
Code Size 2567 Byte
Status TLE
Exec Time 2041 ms
Memory 944 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
TLE × 35
Set Name Test Cases
All 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
Case Name Status Exec Time Memory
rand0.txt TLE 2029 ms 940 KB
rand1.txt TLE 2029 ms 932 KB
rand10.txt TLE 2029 ms 940 KB
rand11.txt TLE 2029 ms 944 KB
rand12.txt TLE 2030 ms 864 KB
rand13.txt TLE 2030 ms 932 KB
rand14.txt TLE 2028 ms 924 KB
rand15.txt TLE 2029 ms 928 KB
rand16.txt TLE 2029 ms 932 KB
rand17.txt TLE 2029 ms 924 KB
rand18.txt TLE 2029 ms 932 KB
rand19.txt TLE 2030 ms 936 KB
rand2.txt TLE 2029 ms 864 KB
rand20.txt TLE 2041 ms 924 KB
rand21.txt TLE 2029 ms 932 KB
rand22.txt TLE 2029 ms 940 KB
rand23.txt TLE 2029 ms 884 KB
rand24.txt TLE 2030 ms 932 KB
rand25.txt TLE 2030 ms 940 KB
rand26.txt TLE 2035 ms 924 KB
rand27.txt TLE 2029 ms 940 KB
rand28.txt TLE 2029 ms 884 KB
rand29.txt TLE 2029 ms 936 KB
rand3.txt TLE 2033 ms 944 KB
rand4.txt TLE 2029 ms 932 KB
rand5.txt TLE 2029 ms 884 KB
rand6.txt TLE 2031 ms 828 KB
rand7.txt TLE 2029 ms 936 KB
rand8.txt TLE 2029 ms 924 KB
rand9.txt TLE 2029 ms 932 KB
s1.txt TLE 2029 ms 936 KB
s2.txt TLE 2030 ms 932 KB
s3.txt TLE 2028 ms 928 KB
s4.txt TLE 2036 ms 920 KB
s5.txt TLE 2028 ms 936 KB