Submission #105700

# Submission time Handle Problem Language Result Execution time Memory
105700 2019-04-14T04:15:19 Z Pro_ktmr 라멘 (JOI14_ramen) C++14
100 / 100
3 ms 396 KB
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

#include"ramen.h"
void Ramen(int N){
	if(N == 1){
		Answer(0,0);
		return;
	}
	vector<int> minKoho,maxKoho;
	for(int i=0; i+1<N; i+=2){
		if(Compare(i,i+1) == 1){
			maxKoho.push_back(i);
			minKoho.push_back(i+1);
		}
		else{
			maxKoho.push_back(i+1);
			minKoho.push_back(i);
		}
	}
	if(N%2 == 1){
		maxKoho.push_back(N-1);
		minKoho.push_back(N-1);
	}

	int minimum = minKoho[0];
	for(int i=1; i<minKoho.size(); i++){
		if(Compare(minimum,minKoho[i]) == 1) minimum = minKoho[i];
	}
	int maximum = maxKoho[0];
	for(int i=1; i<maxKoho.size(); i++){
		if(Compare(maxKoho[i],maximum) == 1) maximum = maxKoho[i];
	}
	Answer(minimum, maximum);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:56:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1; i<minKoho.size(); i++){
               ~^~~~~~~~~~~~~~~
ramen.cpp:60:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1; i<maxKoho.size(); i++){
               ~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 300 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct