Submission #992052

#TimeUsernameProblemLanguageResultExecution timeMemory
992052CallieBank (IZhO14_bank)Java
Compilation error
0 ms0 KiB
#include <iostream> #include <utility> #include <vector> using namespace std; int main() { int people, banknotes; cin >> people >> banknotes; vector<int> plist(people); vector<int> blist(banknotes); for(int i = 0; i < people; i++) { cin >> plist[i]; } for(int i = 0; i < banknotes; i++) { cin >> blist[i]; } vector<vector<int> > dp((1 << banknotes), vector<int>(2)); for(int i = 0; i < (1 << banknotes); i++) { dp[i][0] = -1; dp[i][1] = -1; } dp[0][0] = 0; dp[0][1] = 0; for(int i = 0; i < (1 << banknotes); i++) { for(int j = 0; j < banknotes; j++) { if((i & (1 << j)) == 0) continue; if(dp[i ^ (1 << j)][0] == -1) continue; if(dp[i ^ (1 << j)][0] == banknotes) continue; int p = dp[i ^ (1 << j)][0]; int b = dp[i ^ (1 << j)][1]; if(b + blist[j] < plist[p]) { dp[i][0] = p; dp[i][1] = b + blist[j]; } else if(b + blist[j] <= plist[p]) { dp[i][0] = p + 1; dp[i][1] = 0; } } } for(int i = 0; i < (1 << banknotes); i++) { if(dp[i][0] == people) { cout << "YES"; return 0; } } cout << "NO"; return 0; }

Compilation message (stderr)

bank.java:1: error: illegal character: '#'
#include <iostream>
^
bank.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
bank.java:2: error: illegal character: '#'
#include <utility>
^
bank.java:3: error: illegal character: '#'
#include <vector>
^
bank.java:6: error: class, interface, or enum expected
int main() {
^
bank.java:8: error: class, interface, or enum expected
	cin >> people >> banknotes;
	^
bank.java:9: error: class, interface, or enum expected
	vector<int> plist(people);
	^
bank.java:10: error: class, interface, or enum expected
	vector<int> blist(banknotes);
	^
bank.java:12: error: class, interface, or enum expected
	for(int i = 0; i < people; i++) {
	^
bank.java:12: error: class, interface, or enum expected
	for(int i = 0; i < people; i++) {
	               ^
bank.java:12: error: class, interface, or enum expected
	for(int i = 0; i < people; i++) {
	                           ^
bank.java:14: error: class, interface, or enum expected
	}
	^
bank.java:16: error: class, interface, or enum expected
	for(int i = 0; i < banknotes; i++) {
	               ^
bank.java:16: error: class, interface, or enum expected
	for(int i = 0; i < banknotes; i++) {
	                              ^
bank.java:18: error: class, interface, or enum expected
	}
	^
bank.java:21: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	^
bank.java:21: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	               ^
bank.java:21: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	                                     ^
bank.java:23: error: class, interface, or enum expected
		dp[i][1] = -1;
		^
bank.java:24: error: class, interface, or enum expected
	}
	^
bank.java:26: error: class, interface, or enum expected
	dp[0][1] = 0;
	^
bank.java:28: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	^
bank.java:28: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	               ^
bank.java:28: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	                                     ^
bank.java:29: error: class, interface, or enum expected
		for(int j = 0; j < banknotes; j++) {
		               ^
bank.java:29: error: class, interface, or enum expected
		for(int j = 0; j < banknotes; j++) {
		                              ^
bank.java:31: error: class, interface, or enum expected
			if(dp[i ^ (1 << j)][0] == -1) continue;
			^
bank.java:32: error: class, interface, or enum expected
			if(dp[i ^ (1 << j)][0] == banknotes) continue;
			^
bank.java:34: error: class, interface, or enum expected
			int p = dp[i ^ (1 << j)][0];
			^
bank.java:35: error: class, interface, or enum expected
			int b = dp[i ^ (1 << j)][1];
			^
bank.java:37: error: class, interface, or enum expected
			if(b + blist[j] < plist[p]) {
			^
bank.java:39: error: class, interface, or enum expected
				dp[i][1] = b + blist[j];
				^
bank.java:40: error: class, interface, or enum expected
			}
			^
bank.java:43: error: class, interface, or enum expected
				dp[i][1] = 0;
				^
bank.java:44: error: class, interface, or enum expected
			}
			^
bank.java:48: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	               ^
bank.java:48: error: class, interface, or enum expected
	for(int i = 0; i < (1 << banknotes); i++) {
	                                     ^
bank.java:51: error: class, interface, or enum expected
			return 0;
			^
bank.java:52: error: class, interface, or enum expected
		}
		^
bank.java:56: error: class, interface, or enum expected
	return 0;
	^
bank.java:57: error: class, interface, or enum expected
}
^
41 errors