Submission #486057

#TimeUsernameProblemLanguageResultExecution timeMemory
486057flappybird라멘 (JOI14_ramen)C++14
100 / 100
1 ms292 KiB
#include "ramen.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void Ramen(int N) { if (N == 1) { Answer(0, 0); return; } ll i; vector<ll> v1; vector<ll> v2; if (N % 2) { for (i = 0; i < N - 1; i += 2) { if (Compare(i, i + 1) == -1) v1.push_back(i), v2.push_back(i + 1); else v1.push_back(i + 1), v2.push_back(i); } ll r1, r2; if (Compare(N - 1, N - 2) == -1) { if (v1[v1.size() - 1] == N - 2) v1.pop_back(); v1.push_back(N - 1); } else { if (v2[v2.size() - 1] == N - 2) v2.pop_back(); v2.push_back(N - 1); } } else { for (i = 0; i < N; i += 2) { if (Compare(i, i + 1) == -1) v1.push_back(i), v2.push_back(i + 1); else v1.push_back(i + 1), v2.push_back(i); } } ll aa, bb; aa = v1[0]; for (i = 1; i < v1.size(); i++) if (Compare(aa, v1[i]) == 1) aa = v1[i]; bb = v2[0]; for (i = 1; i < v2.size(); i++) if (Compare(bb, v2[i]) == -1) bb = v2[i]; Answer(aa, bb); }

Compilation message (stderr)

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:20:6: warning: unused variable 'r1' [-Wunused-variable]
   20 |   ll r1, r2;
      |      ^~
ramen.cpp:20:10: warning: unused variable 'r2' [-Wunused-variable]
   20 |   ll r1, r2;
      |          ^~
ramen.cpp:38:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for (i = 1; i < v1.size(); i++) if (Compare(aa, v1[i]) == 1) aa = v1[i];
      |              ~~^~~~~~~~~~~
ramen.cpp:40:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |  for (i = 1; i < v2.size(); i++) if (Compare(bb, v2[i]) == -1) bb = v2[i];
      |              ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...