답안 #1088004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088004 2024-09-13T16:48:02 Z mickey080929 질문 (CEOI14_question_grader) C++17
100 / 100
2252 ms 24568 KB
#include <bits/stdc++.h>

using namespace std;

queue<vector<int>> q;

vector<vector<int>> comb(int length) {
   if (length == 1) {
      vector<vector<int>> ret;
      for (int i = 1; i < 13; i += 1) {
         ret.push_back({ i });
      }
      return ret;
   }
   else {
      vector<vector<int>> L = comb(length - 1);
      vector<vector<int>> retL;
      for (vector<int> l : L) {
         for (int i = l[l.size() - 1] + 1; i < 13; i += 1) {
            vector<int> newl = l;
            newl.push_back(i);
            retL.push_back(newl);
         }
      }
      return retL;
   }
}

vector<vector<int>> l_12 = comb(6);

int encode (int n, int x, int y) {
   for (int j = 1; j < 13; j += 1) {
      if (find(l_12[x].begin(), l_12[x].end(), j) != l_12[x].end()) {
         if (find(l_12[y].begin(), l_12[y].end(), j) == l_12[y].end()) {
            return j;
            break;
         }
      }
   }
}
#include <bits/stdc++.h>

using namespace std;

queue<vector<int>> q;

vector<vector<int>> comb(int length) {
   if (length == 1) {
      vector<vector<int>> ret;
      for (int i = 1; i < 13; i += 1) {
         ret.push_back({ i });
      }
      return ret;
   }
   else {
      vector<vector<int>> L = comb(length - 1);
      vector<vector<int>> retL;
      for (vector<int> l : L) {
         for (int i = l[l.size() - 1] + 1; i < 13; i += 1) {
            vector<int> newl = l;
            newl.push_back(i);
            retL.push_back(newl);
         }
      }
      return retL;
   }
}

vector<vector<int>> l_12 = comb(6);

int decode (int n, int q, int h) {
	if (find(l_12[q].begin(), l_12[q].end(), h) != l_12[q].end()) {
	   return 1;
	 }
	 else {
	    return 0;
	 }
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2252 ms 24568 KB Output is correct - maxh = 12
2 Correct 2074 ms 24560 KB Output is correct - maxh = 12