답안 #200515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
200515 2020-02-07T03:27:45 Z arnold518 라멘 (JOI14_ramen) C++14
100 / 100
6 ms 424 KB
#include "ramen.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int N;

void Ramen(int _N)
{
	int i, j;
	N=_N;

	vector<int> A, B;
	for(i=0; i+1<N; i+=2)
	{
		int t=Compare(i, i+1);
		if(t==1) A.push_back(i), B.push_back(i+1);
		else B.push_back(i), A.push_back(i+1);
	}

	if(N%2) A.push_back(N-1), B.push_back(N-1);

	int X=A[0];
	for(i=1; i<A.size(); i++)
	{
		int t=Compare(X, A[i]);
		if(t==-1) X=A[i];
	}

	int Y=B[0];
	for(i=1; i<B.size(); i++)
	{
		int t=Compare(Y, B[i]);
		if(t==1) Y=B[i];
	}

	Answer(Y, X);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:27:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1; i<A.size(); i++)
           ~^~~~~~~~~
ramen.cpp:34:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1; i<B.size(); i++)
           ~^~~~~~~~~
ramen.cpp:13:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 424 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct