Submission #3002411


Source Code Expand

//TLE解法その2
#include <iostream>
#include <tuple>
#include <algorithm>
#include <functional>
using namespace std;
typedef tuple<int, int, int, int> T;

int n, m;
T t[50000];
int a[50000], b[50000], c[50000], w[50000];
int x[50000], y[50000], z[50000];

int main() {
	int i, j;
	
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i] >> w[i];
		t[i] = T(w[i], a[i], b[i], c[i]);
	}
	sort(t, t + n, greater<T>());
	
	for (i = 0; i < n; i++) {
		w[i] = get<0>(t[i]);
		a[i] = get<1>(t[i]);
		b[i] = get<2>(t[i]);
		c[i] = get<3>(t[i]);
	}
	
	for (i = 0; i < m; i++) cin >> x[i] >> y[i] >> z[i];
	
	for (i = 0; i < m; i++) {
		for (j = 0; j < n; j++) {
			if (x[i] >= a[j] && y[i] >= b[j] && z[i] >= c[j]) {
				break;
			}
		}
		if (j == n) cout << 0 << endl;
		else cout << w[j] << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task C - Optimal Recommendations
User startcpp
Language C++ (Clang 3.8.0)
Score 0
Code Size 868 Byte
Status CE

Compile Error

./Main.cpp:7:9: error: unknown type name 'tuple'
typedef tuple<int, int, int, int> T;
        ^
./Main.cpp:7:14: error: expected unqualified-id
typedef tuple<int, int, int, int> T;
             ^
./Main.cpp:10:1: error: unknown type name 'T'
T t[50000];
^
./Main.cpp:20:10: error: use of undeclared identifier 'T'
                t[i] = T(w[i], a[i], b[i], c[i]);
                       ^
./Main.cpp:22:25: error: use of undeclared identifier 'T'
        sort(t, t + n, greater<T>());
                               ^
5 errors generated.