제출 #988178

#제출 시각아이디문제언어결과실행 시간메모리
988178kachim2Arranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms348 KiB
#include "shoes.h" #include <climits> #include <vector> #include <queue> #include <iostream> long long count_swaps(std::vector<int> s) { return 1; std::vector<int> pos(s.size(), INT_MIN); std::vector<int> spos(s.size()); std::vector<int> rpos(s.size()); for (int i = 0; i < s.size(); i++) { spos[i] = i; } for (int i = 0; i < s.size(); i++) { rpos[i] = i; } auto qm = new std::queue<int>[100007]; auto qp = new std::queue<int> [100007]; for (int i = 0; i < s.size(); i++) { if (s[i] < 0) { if (qp[-s[i]].empty()) { qm[-s[i]].push(i); } else { auto x = qp[-s[i]].front(); qp[-s[i]].pop(); pos[i] = x; } } else { if (qm[s[i]].empty()) { qp[s[i]].push(i); } else { auto x = qm[s[i]].front(); qm[s[i]].pop(); pos[i] = x; } } } long count = 0; for (int i = 0; i < s.size(); i++) { if (pos[i] >= 0) { int wp = s[spos[i]] > 0 ? spos[pos[i]] + 1 : spos[pos[i]]; count+=spos[i]-wp; for (int j = wp; j < spos[i]; j++) { spos[rpos[j]]++; rpos[spos[j]] = j; } spos[i] = wp; rpos[wp] = i; } } for (auto i : spos) { std::cerr << i << ' '; } std::cerr << '\n'; for (auto i : rpos) { std::cerr << i << ' '; } std::cerr << '\n'; for (auto i : pos) { std::cerr << i << ' '; } return count; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:11:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |       for (int i = 0; i < s.size(); i++) {
      |                       ~~^~~~~~~~~~
shoes.cpp:14:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |       for (int i = 0; i < s.size(); i++) {
      |                       ~~^~~~~~~~~~
shoes.cpp:20:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |       for (int i = 0; i < s.size(); i++) {
      |                       ~~^~~~~~~~~~
shoes.cpp:40:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       for (int i = 0; i < s.size(); i++) {
      |                       ~~^~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...