Submission #736162

#TimeUsernameProblemLanguageResultExecution timeMemory
736162marvinthangUnija (COCI17_unija)C++17
100 / 100
317 ms21960 KiB
/****************************** * 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 (stderr)

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");
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...