답안 #736162

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
736162 2023-05-05T09:12:03 Z marvinthang Unija (COCI17_unija) C++17
100 / 100
317 ms 21960 KB
/******************************
*    author : @marvinthang    *
*    date : 09 / 02 / 2022    *
******************************/

#include <bits/stdc++.h>

using namespace std;

#define  superspeed  ios_base::sync_with_stdio(false); cin.tie(nullptr); // cout.tie(nullptr);
#define  file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }

template <class U, class V> ostream & operator << (ostream& out, const pair<U, V> &p) { return out << '(' << p.first << ", " << p.second << ')'; }
template <class T> ostream & operator << (ostream &out, const vector<T> &vt) { out << '{'; for (size_t i = 0; i + 1 < vt.size(); i++) out << vt[i] << ", "; if (!vt.empty()) out << vt.back(); return out << '}'; }

const 		int MOD = 1e9 + 7;
const     double PI = 3.1415926535897932384626433832795; // acos(-1.0); atan(-1.0);
const     int dir[] = {0, 1, 0, -1, 0}; // {0, 1, 1, -1, -1, 1, 0, -1, 0};
const  long long oo = 1e18;
const       int MAX = 1e5 + 5;

int N, h[5000006];

int main(void) {
    superspeed;
    file("coci1617_r5_unija");
    cin >> N;
    for (int i = 0; i < N; ++i) {
    	int x, y; cin >> x >> y;
    	if (h[x / 2] < y) h[x / 2] = y;
    }
    long long res = 0;
    for (int i = 5000000; i > 0; --i) {
    	if (h[i] < h[i + 1]) h[i] = h[i + 1];
    	res += h[i];
    }
    cout << (res << 1) << '\n';
    return 0;
}

Compilation message

unija.cpp: In function 'int main()':
unija.cpp:11:61: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define  file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
unija.cpp:26:5: note: in expansion of macro 'file'
   26 |     file("coci1617_r5_unija");
      |     ^~~~
unija.cpp:11:95: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define  file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                                                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
unija.cpp:26:5: note: in expansion of macro 'file'
   26 |     file("coci1617_r5_unija");
      |     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 9 ms 340 KB Output is correct
3 Correct 9 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 8 ms 324 KB Output is correct
3 Correct 8 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 8 ms 340 KB Output is correct
3 Correct 9 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 340 KB Output is correct
2 Correct 9 ms 460 KB Output is correct
3 Correct 9 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 21864 KB Output is correct
2 Correct 264 ms 21960 KB Output is correct
3 Correct 244 ms 21836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 8 ms 340 KB Output is correct
3 Correct 7 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 852 KB Output is correct
2 Correct 12 ms 852 KB Output is correct
3 Correct 12 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2248 KB Output is correct
2 Correct 26 ms 2280 KB Output is correct
3 Correct 25 ms 2388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 6348 KB Output is correct
2 Correct 61 ms 6356 KB Output is correct
3 Correct 70 ms 6352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 242 ms 21856 KB Output is correct
2 Correct 245 ms 21820 KB Output is correct
3 Correct 244 ms 21832 KB Output is correct