Submission #1590888


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int t, n, m, a[105], b[105];
bool used[105];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> t >> n;
	FOR(i, n) cin >> a[i];
	cin >> m;
	FOR(j, m) {
		cin >> b;
		bool ok = false;
		FOR(i, n) {
			if (used[i]) continue;
			if (b-t <= a[i] && a[i] <= b) {
				ok = true;
				used[i] = true;
			}
		}
		if (!ok) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

Submission Info

Submission Time
Task C - おいしいたこ焼きの売り方
User moguta
Language C++14 (GCC 5.4.1)
Score 0
Code Size 706 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:18:7: error: no match for ‘operator>>’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘int [105]’)
   cin >> b;
       ^
In file included from /usr/include/c++/5/sstream:38:0,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from ./Main.cpp:1:
/usr/include/c++/5/istream:168:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>
       operator>>(bool& __n)
       ^
/usr/include/c++/5/istream:168:7: note:   conversion of argument 1 would be ill-formed:
./Main.cpp:18:10: error: invalid initialization of non-const reference of type ‘bool&’ from an rvalue of ty...