답안 #1058170

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058170 2024-08-14T08:49:46 Z vjudge1 Unija (COCI17_unija) Java 11
컴파일 오류
0 ms 0 KB
// Author: RainPPR
// Datetime: 2024-08-14 08:02

#include <bits/stdc++.h>

#ifdef __linux__
#include <bits/extc++.h>
#define gc() getchar_unlocked()
#else
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/list_update_policy.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#define gc() getchar()
#endif

#define endl "\n"

using namespace std;

template<typename T>

T read() {
	T n = 0;
	int f = 0, c = gc();
	for (; !isdigit(c); c = gc())
		f |= c == '-';
	for (; isdigit(c); c = gc())
		n = n * 10 + c - '0';
	return f ? -n : n;
}

template<typename T, typename CMP = less<T>>
using pqueue = __gnu_pbds::priority_queue<T, CMP>;
// using pqueue = priority_queue<T, vector<T>, CMP>;

// -----------------------------------------------------------------------------

void Main() {
	int n;
	cin >> n;
	map<int, int, greater<int>> app;
	for (int i = 1; i <= n; ++i) {
		int x, y;
		cin >> x >> y;
		x >>= 1, y >>= 1;
		app[x] = max(app[x], y);
	}
	int lt = 0;
	long long ans = 0;
	for (auto t : app) {
		int x = t.first;
		int y = t.second;
		ans += 1ll * max(y - lt, 0) * x;
		lt = max(lt, y);
	}
	cout << (ans << 2) << endl;
}

signed main() {
//	freopen("unija.in", "r", stdin);
//	freopen("unija.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	Main();
	return 0;
}

Compilation message

unija.java:4: error: illegal character: '#'
#include <bits/stdc++.h>
^
unija.java:4: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
unija.java:6: error: illegal character: '#'
#ifdef __linux__
^
unija.java:7: error: illegal character: '#'
#include <bits/extc++.h>
^
unija.java:8: error: illegal character: '#'
#define gc() getchar_unlocked()
^
unija.java:9: error: illegal character: '#'
#else
^
unija.java:10: error: illegal character: '#'
#include <ext/rope>
^
unija.java:11: error: illegal character: '#'
#include <ext/pb_ds/assoc_container.hpp>
^
unija.java:12: error: illegal character: '#'
#include <ext/pb_ds/priority_queue.hpp>
^
unija.java:13: error: illegal character: '#'
#include <ext/pb_ds/exception.hpp>
^
unija.java:14: error: illegal character: '#'
#include <ext/pb_ds/hash_policy.hpp>
^
unija.java:15: error: illegal character: '#'
#include <ext/pb_ds/list_update_policy.hpp>
^
unija.java:16: error: illegal character: '#'
#include <ext/pb_ds/tree_policy.hpp>
^
unija.java:17: error: illegal character: '#'
#include <ext/pb_ds/trie_policy.hpp>
^
unija.java:18: error: illegal character: '#'
#define gc() getchar()
^
unija.java:19: error: illegal character: '#'
#endif
^
unija.java:21: error: illegal character: '#'
#define endl "\n"
^
unija.java:25: error: class, interface, or enum expected
template<typename T>
^
unija.java:29: error: class, interface, or enum expected
	int f = 0, c = gc();
	^
unija.java:30: error: class, interface, or enum expected
	for (; !isdigit(c); c = gc())
	^
unija.java:30: error: class, interface, or enum expected
	for (; !isdigit(c); c = gc())
	       ^
unija.java:30: error: class, interface, or enum expected
	for (; !isdigit(c); c = gc())
	                    ^
unija.java:32: error: class, interface, or enum expected
	for (; isdigit(c); c = gc())
	^
unija.java:32: error: class, interface, or enum expected
	for (; isdigit(c); c = gc())
	       ^
unija.java:32: error: class, interface, or enum expected
	for (; isdigit(c); c = gc())
	                   ^
unija.java:34: error: class, interface, or enum expected
	return f ? -n : n;
	^
unija.java:35: error: class, interface, or enum expected
}
^
unija.java:43: error: class, interface, or enum expected
void Main() {
^
unija.java:45: error: class, interface, or enum expected
	cin >> n;
	^
unija.java:46: error: class, interface, or enum expected
	map<int, int, greater<int>> app;
	^
unija.java:47: error: class, interface, or enum expected
	for (int i = 1; i <= n; ++i) {
	^
unija.java:47: error: class, interface, or enum expected
	for (int i = 1; i <= n; ++i) {
	                ^
unija.java:47: error: class, interface, or enum expected
	for (int i = 1; i <= n; ++i) {
	                        ^
unija.java:49: error: class, interface, or enum expected
		cin >> x >> y;
		^
unija.java:50: error: class, interface, or enum expected
		x >>= 1, y >>= 1;
		^
unija.java:51: error: class, interface, or enum expected
		app[x] = max(app[x], y);
		^
unija.java:52: error: class, interface, or enum expected
	}
	^
unija.java:54: error: class, interface, or enum expected
	long long ans = 0;
	^
unija.java:55: error: class, interface, or enum expected
	for (auto t : app) {
	^
unija.java:57: error: class, interface, or enum expected
		int y = t.second;
		^
unija.java:58: error: class, interface, or enum expected
		ans += 1ll * max(y - lt, 0) * x;
		^
unija.java:59: error: class, interface, or enum expected
		lt = max(lt, y);
		^
unija.java:60: error: class, interface, or enum expected
	}
	^
unija.java:62: error: class, interface, or enum expected
}
^
unija.java:68: error: class, interface, or enum expected
	cin.tie(nullptr), cout.tie(nullptr);
	^
unija.java:69: error: class, interface, or enum expected
	Main();
	^
unija.java:70: error: class, interface, or enum expected
	return 0;
	^
unija.java:71: error: class, interface, or enum expected
}
^
48 errors