Submission #147142
Source Code Expand
#include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> #include <functional> #include <iterator> #include <limits> #include <numeric> #include <utility> #include <cmath> using namespace std; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VS = vector<string>; using SS = stringstream; using PII = pair<int,int>; using VPII = vector< pair<int,int> >; template < typename T = int > using VT = vector<T>; template < typename T = int > using VVT = VT< VT<T> >; template < typename T = int > using LIM = numeric_limits<T>; template < typename T > inline T fromString( const string &s ){ T res; istringstream iss( s ); iss >> res; return res; }; template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); }; #define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define FOR( e, c ) for ( auto &e : c ) #define ALL( c ) (c).begin(), (c).end() #define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) #define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end() #define PB( n ) push_back( n ) #define MP( a, b ) make_pair( ( a ), ( b ) ) #define EXIST( c, e ) ( (c).find( e ) != (c).end() ) #define fst first #define snd second #define DUMP( x ) cerr << #x << " = " << ( x ) << endl int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); int t, n; cin >> t >> n; VI creates( 101 ); REP( i, 0, n ) { int a; cin >> a; creates[a]++; } int m; cin >> m; VI coming( 101 ); REP( i, 0, m ) { int b; cin >> b; coming[b]++; } priority_queue< int, VI, greater<int> > que; REP( i, 0, 101 ) { while ( creates[i]-- ) que.push( i ); while ( !que.empty() && t < i - que.top() ) que.pop(); if ( (int)que.size() < coming[i] ) { cout << "no" << endl; return 0; } while ( coming[i]-- ) que.pop(); } cout << "yes" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - おいしいたこ焼きの売り方 |
User | torus711 |
Language | C++11 (GCC 4.8.1) |
Score | 100 |
Code Size | 2111 Byte |
Status | AC |
Exec Time | 24 ms |
Memory | 936 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | AC | 20 ms | 932 KB |
rand1.txt | AC | 22 ms | 924 KB |
rand10.txt | AC | 23 ms | 924 KB |
rand11.txt | AC | 21 ms | 808 KB |
rand12.txt | AC | 22 ms | 932 KB |
rand13.txt | AC | 21 ms | 808 KB |
rand14.txt | AC | 21 ms | 928 KB |
rand15.txt | AC | 23 ms | 932 KB |
rand16.txt | AC | 22 ms | 804 KB |
rand17.txt | AC | 24 ms | 764 KB |
rand18.txt | AC | 21 ms | 928 KB |
rand19.txt | AC | 21 ms | 804 KB |
rand2.txt | AC | 20 ms | 796 KB |
rand20.txt | AC | 21 ms | 808 KB |
rand21.txt | AC | 21 ms | 936 KB |
rand22.txt | AC | 21 ms | 928 KB |
rand23.txt | AC | 21 ms | 808 KB |
rand24.txt | AC | 22 ms | 804 KB |
rand25.txt | AC | 21 ms | 932 KB |
rand26.txt | AC | 22 ms | 796 KB |
rand27.txt | AC | 22 ms | 800 KB |
rand28.txt | AC | 23 ms | 784 KB |
rand29.txt | AC | 21 ms | 812 KB |
rand3.txt | AC | 21 ms | 808 KB |
rand4.txt | AC | 23 ms | 796 KB |
rand5.txt | AC | 24 ms | 932 KB |
rand6.txt | AC | 22 ms | 804 KB |
rand7.txt | AC | 21 ms | 804 KB |
rand8.txt | AC | 22 ms | 800 KB |
rand9.txt | AC | 22 ms | 928 KB |
s1.txt | AC | 22 ms | 796 KB |
s2.txt | AC | 23 ms | 776 KB |
s3.txt | AC | 22 ms | 920 KB |
s4.txt | AC | 21 ms | 808 KB |
s5.txt | AC | 24 ms | 764 KB |