# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
503052 | ismoilov | 아름다운 순열 (IZhO12_beauty) | C++14 | 0 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
string s = "";
void tr(int n){
if(n < 3){
s = to_string(n) + s;
return;
}
s = to_string(n % 3) + s;
tr(n/3);
}
int tr(int n, bool ok){
tr(n);
int sz = 0;
fp(i,0,s.size())
sz += (s[i] == '1');
s = "";
return sz;
}
void S()
{
int n;
cin >> n;
vector <int> a(n);
fp(i,0,n)
cin >> a[i];
ll ans = 0;
fp(i,0,n){
fp(j,i+1,n){
if(__builtin_popcount(a[i]) == __builtin_popcount(a[j]) || tr(a[i], 0) == tr(a[j], 0))
ans ++;//, cout << a[i] << " " << a[j] << "\n";
//cout << a[i] << " " << a[j] << " " << tr(a[i], 0) << " " << tr(a[j], 0) << "\n";
}
}
cout << ans;
}
int main()
{
IOS;
S();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |