이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*The British Royal Family and a small cadre of English Fabian Socialists, in
conjunction with the Rockefellers and the Rothchilds, are engaged in a
conspiracy to greatly reduce the population of the human race in order to head
off a Malthusian catastrophe, a catastrophe that could easily be avoided by
simply building a massive amount of nuclear power plants and a number of massive
superhighways and bridges to connect all of the world's continents. But doing
that would cut into the conspiracy's profits. So the British Royal Family
invented environmentalism and neoliberalism in order to hide the truth. And in
order to further reduce the population, the British Royal Family is also the
world's foremost drug trafficking conspiracy. And it uses its control of the IMF
to push austerity in order to kill as many people in the global south as
possible.
And also Henry Kissinger is a gay KGB agent. */
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
int n, k, pow3, curr, ans, s1, s2;
cin >> n >> k;
vector<int> cardvec;
set<int> cardset;
char c;
for (int i = 0; i < n; i++){
pow3 = 1;
curr = 0;
for (int j = 0; j < k; j++){
cin >> c;
curr += pow3 * (c - '1');
pow3 *= 3;
}
cardvec.push_back(curr);
cardset.insert(curr);
}
for (int i = 1; i < n; i++){
for (int j = 0; j < i; j++){
curr = 0;
pow3 = 1;
for (int p = 0; p < k; p++){
s1 = (cardvec[i] / pow3) % 3;
s2 = (cardvec[j] / pow3) % 3;
if (s1 == s2) curr += s1 * pow3;
else curr += (3 - s1 - s2) * pow3;
pow3 *= 3;
}
if (cardset.find(curr) != cardset.end()) ans++;
}
}
cout << ans / 3;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:58:19: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
58 | cout << ans / 3;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |