# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
64708 | bazsi700 | 질문 (CEOI14_question_grader) | C++14 | 32 ms | 1152 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string tobase(int a, int base) {
string str = "";
while(a > 0) {
cout << a << " " << str << endl;
char ch = a%base;
str+= ch+'0';
a/=base;
}
reverse(str.begin(),str.end());
return str;
}
int encode(int n, int x, int y) {
string sx = tobase(x,3);
string sy = tobase(y,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
while(sy.length() < 6) {
sy = '0'+sy;
}
for(int i = 0; i < 6; i++) {
if(sx.at(i) != sy.at(i)) {
return (3*i)+sx.at(i)-'0'+1;
}
}
return 0;
}
bool decode(int n, int q, int h) {
h--;
string sx = tobase(q,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
if(sx.at(h/3)-'0' ==h%3) {
return false;
} else {
return true;
}
}
/*
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int ty;
cin >> ty;
int T,n;
cin >> T >> n;
if(ty == 1) {
while(T--) {
int x,y;
cin >> x >> y;
string sx = tobase(x,3);
string sy = tobase(y,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
while(sy.length() < 6) {
sy = '0'+sy;
}
for(int i = 0; i < 6; i++) {
if(sx.at(i) != sy.at(i)) {
cout << (3*i)+sx.at(i)-'0' << "\n";
break;
}
}
}
} else {
while(T--) {
int q,h;
cin >> q >> h;
}
}
return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string tobase(int a, int base) {
string str = "";
while(a > 0) {
cout << a << " " << str << endl;
char ch = a%base;
str+= ch+'0';
a/=base;
}
reverse(str.begin(),str.end());
return str;
}
int encode(int n, int x, int y) {
string sx = tobase(x,3);
string sy = tobase(y,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
while(sy.length() < 6) {
sy = '0'+sy;
}
for(int i = 0; i < 6; i++) {
if(sx.at(i) != sy.at(i)) {
return (3*i)+sx.at(i)-'0'+1;
}
}
return 0;
}
bool decode(int n, int q, int h) {
h--;
string sx = tobase(q,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
if(sx.at(h/3)-'0' ==h%3) {
return false;
} else {
return true;
}
}
/*
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int ty;
cin >> ty;
int T,n;
cin >> T >> n;
if(ty == 1) {
while(T--) {
int x,y;
cin >> x >> y;
string sx = tobase(x,3);
string sy = tobase(y,3);
while(sx.length() < 6) {
sx = '0'+sx;
}
while(sy.length() < 6) {
sy = '0'+sy;
}
for(int i = 0; i < 6; i++) {
if(sx.at(i) != sy.at(i)) {
cout << (3*i)+sx.at(i)-'0' << "\n";
break;
}
}
}
} else {
while(T--) {
int q,h;
cin >> q >> h;
}
}
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |