#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <map>
#include <list>
#include <stdlib.h>
#include <unordered_set>
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 main() {
iostream::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int ab = 1;
if (ab == 1) {
int N, T;
cin >> N >> T;
for (int i = 0; i < T; i += 1) {
int x, y;
cin >> x >> 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()) {
cout << j;
break;
}
}
}
}
}
else {
int N, T;
cin >> N >> T;
for (int i = 0; i < T; i += 1) {
int q, h;
cin >> q >> h;
if (find(l_12[q].begin(), l_12[q].end(), h) != l_12[q].end()) {
cout << "yes";
}
else {
cout << "no";
}
}
}
}
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <map>
#include <list>
#include <stdlib.h>
#include <unordered_set>
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 main() {
iostream::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int ab = 2;
if (ab == 1) {
int N, T;
cin >> N >> T;
for (int i = 0; i < T; i += 1) {
int x, y;
cin >> x >> 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()) {
cout << j;
break;
}
}
}
}
}
else {
int N, T;
cin >> N >> T;
for (int i = 0; i < T; i += 1) {
int q, h;
cin >> q >> h;
if (find(l_12[q].begin(), l_12[q].end(), h) != l_12[q].end()) {
cout << "yes";
}
else {
cout << "no";
}
}
}
}
Compilation message
/usr/bin/ld: /tmp/ccFbBEt3.o: in function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/cc47G5O2.o:encoder.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccFbBEt3.o: in function `main':
grader_encode.c:(.text.startup+0x129): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status
/usr/bin/ld: /tmp/ccLYohqO.o: in function `main':
grader_decode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPz4eZL.o:decoder.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccLYohqO.o: in function `main':
grader_decode.c:(.text.startup+0x22f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status