제출 #294496

#제출 시각아이디문제언어결과실행 시간메모리
294496FlashGamezzz사다리꼴 (balkan11_trapezoid)Java
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include <queue> #include <set> #include <map> using namespace std; struct trap { long a, b, c, d, i; trap(long i1, long i2, long i3, long i4){ a = i1; b = i2; c = i3; d = i4; i = 0; } }; struct comp1 { bool operator()(trap t1, trap t2){ return t1.a > t2.a; } }; struct comp2 { bool operator()(trap t1, trap t2){ return t1.b > t2.b; } }; long n, dp[100000]; //dp[i] stores longest sequence ending in trapezoid i priority_queue<trap, vector<trap>, comp1> pqa; // for sorting the values by a initially priority_queue<trap, vector<trap>, comp2> pqb; // sorts trapezoids by b map<long, long> mp; //map(i, j) j = longest sequence of trapezoids with lower right distance i int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for (long i = 0; i < n; i++){ long i1, i2, i3, i4; cin >> i1 >> i2 >> i3 >> i4; pqa.push(trap(i1, i2, i3, i4)); } mp.insert(make_pair(-1, 0)); long a1 = 0; for (int i = 0; i < n; i++){ trap curr = pqa.top(); pqa.pop(); map<long, long>::iterator temp; while (pqb.size() > 0 && pqb.top().b < curr.a){ //while the b values in our priority queue are less than our current a temp = mp.lower_bound(pqb.top().d); temp--; //find lowest value in map that's smaller than our current mp.insert(make_pair(pqb.top().d, max(dp[pqb.top().i], temp->second))); //map values pqb.pop(); } curr.i = i; //set i so that we can find the dp value associated with this trapezoid pqb.push(curr); temp = mp.lower_bound(curr.c); temp--; //find longest sequence of trapezoids with lower right distance i less than curr.c dp[i] = temp->second + 1; a1 = max(a1, dp[i]); } cout << a1 << endl; }

컴파일 시 표준 에러 (stderr) 메시지

trapezoid.java:1: error: illegal character: '#'
#include <iostream>
^
trapezoid.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
trapezoid.java:2: error: illegal character: '#'
#include <cstdlib>
^
trapezoid.java:3: error: illegal character: '#'
#include <cstdio>
^
trapezoid.java:4: error: illegal character: '#'
#include <fstream>
^
trapezoid.java:5: error: illegal character: '#'
#include <algorithm>
^
trapezoid.java:6: error: illegal character: '#'
#include <string>
^
trapezoid.java:7: error: illegal character: '#'
#include <utility>
^
trapezoid.java:8: error: illegal character: '#'
#include <vector>
^
trapezoid.java:9: error: illegal character: '#'
#include <queue>
^
trapezoid.java:10: error: illegal character: '#'
#include <set>
^
trapezoid.java:11: error: illegal character: '#'
#include <map>
^
trapezoid.java:15: error: class, interface, or enum expected
struct trap {
^
trapezoid.java:17: error: class, interface, or enum expected
	trap(long i1, long i2, long i3, long i4){
	^
trapezoid.java:18: error: class, interface, or enum expected
		a = i1; b = i2; c = i3; d = i4; i = 0;
		        ^
trapezoid.java:18: error: class, interface, or enum expected
		a = i1; b = i2; c = i3; d = i4; i = 0;
		                ^
trapezoid.java:18: error: class, interface, or enum expected
		a = i1; b = i2; c = i3; d = i4; i = 0;
		                        ^
trapezoid.java:18: error: class, interface, or enum expected
		a = i1; b = i2; c = i3; d = i4; i = 0;
		                                ^
trapezoid.java:19: error: class, interface, or enum expected
	}
	^
trapezoid.java:21: error: class, interface, or enum expected
struct comp1 {
^
trapezoid.java:24: error: class, interface, or enum expected
	}
	^
trapezoid.java:26: error: class, interface, or enum expected
struct comp2 {
^
trapezoid.java:29: error: class, interface, or enum expected
	}
	^
trapezoid.java:32: error: class, interface, or enum expected
long n, dp[100000]; //dp[i] stores longest sequence ending in trapezoid i
^
trapezoid.java:33: error: class, interface, or enum expected
priority_queue<trap, vector<trap>, comp1> pqa; // for sorting the values by a initially
^
trapezoid.java:34: error: class, interface, or enum expected
priority_queue<trap, vector<trap>, comp2> pqb; // sorts trapezoids by b
^
trapezoid.java:35: error: class, interface, or enum expected
map<long, long> mp; //map(i, j) j = longest sequence of trapezoids with lower right distance i
^
trapezoid.java:37: error: class, interface, or enum expected
int main(){
^
trapezoid.java:39: error: class, interface, or enum expected
	cin.tie(NULL);
	^
trapezoid.java:40: error: class, interface, or enum expected
	cin >> n;
	^
trapezoid.java:41: error: class, interface, or enum expected
	for (long i = 0; i < n; i++){
	^
trapezoid.java:41: error: class, interface, or enum expected
	for (long i = 0; i < n; i++){
	                 ^
trapezoid.java:41: error: class, interface, or enum expected
	for (long i = 0; i < n; i++){
	                        ^
trapezoid.java:43: error: class, interface, or enum expected
		cin >> i1 >> i2 >> i3 >> i4;
		^
trapezoid.java:44: error: class, interface, or enum expected
		pqa.push(trap(i1, i2, i3, i4));
		^
trapezoid.java:45: error: class, interface, or enum expected
	}
	^
trapezoid.java:47: error: class, interface, or enum expected
	long a1 = 0;
	^
trapezoid.java:48: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	^
trapezoid.java:48: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                ^
trapezoid.java:48: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                       ^
trapezoid.java:49: error: class, interface, or enum expected
		trap curr = pqa.top(); pqa.pop();
		                       ^
trapezoid.java:50: error: class, interface, or enum expected
		map<long, long>::iterator temp;
		^
trapezoid.java:51: error: class, interface, or enum expected
		while (pqb.size() > 0 && pqb.top().b < curr.a){ //while the b values in our priority queue are less than our current a
		^
trapezoid.java:52: error: class, interface, or enum expected
			temp = mp.lower_bound(pqb.top().d); temp--; //find lowest value in map that's smaller than our current
			                                    ^
trapezoid.java:53: error: class, interface, or enum expected
			mp.insert(make_pair(pqb.top().d, max(dp[pqb.top().i], temp->second))); //map values
			^
trapezoid.java:54: error: class, interface, or enum expected
			pqb.pop();
			^
trapezoid.java:55: error: class, interface, or enum expected
		}
		^
trapezoid.java:57: error: class, interface, or enum expected
		pqb.push(curr);
		^
trapezoid.java:58: error: class, interface, or enum expected
		temp = mp.lower_bound(curr.c); temp--; //find longest sequence of trapezoids with lower right distance i less than curr.c
		^
trapezoid.java:58: error: class, interface, or enum expected
		temp = mp.lower_bound(curr.c); temp--; //find longest sequence of trapezoids with lower right distance i less than curr.c
		                               ^
trapezoid.java:59: error: class, interface, or enum expected
		dp[i] = temp->second + 1;
		^
trapezoid.java:60: error: class, interface, or enum expected
		a1 = max(a1, dp[i]);
		^
trapezoid.java:62: error: class, interface, or enum expected
	}
	^
trapezoid.java:64: error: class, interface, or enum expected
}
^
54 errors