제출 #649444

#제출 시각아이디문제언어결과실행 시간메모리
649444birisiXOR Sum (info1cup17_xorsum)C++14
0 / 100
224 ms340 KiB
#include <bits/stdc++.h> using namespace std; int say[5000]; int main() { int n; cin >> n; vector <int> v; int x; for (int i = 0; i < n; i++) { cin >> x; if (say[x] == 0) v.push_back(x); say[x]++; } long long int an = 0; vector <int> d; for (int i = 0; i < v.size(); i++) { x = v[i]; if (say[x]%2 == 1){ d.push_back(x); } if (say[x]%4 == 2) an = an^(2*x); } for (int i = 0; i < d.size(); i++) { for (int j = i; j < d.size(); j++) { an = an ^ (d[i] + d[j]); } } cout << an; }

컴파일 시 표준 에러 (stderr) 메시지

xorsum.cpp: In function 'int main()':
xorsum.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 0; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
xorsum.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for (int i = 0; i < d.size(); i++) {
      |                  ~~^~~~~~~~~~
xorsum.cpp:33:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   for (int j = i; j < d.size(); j++) {
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...