QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#211240 | #5093. 会议 | hos_lyric# | 0 | 31ms | 4676kb | C++14 | 2.6kb | 2023-10-12 13:21:12 | 2024-07-04 02:19:16 |
Judging History
answer
#include "majority.h"
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
namespace {
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
int Q = 0;
vector<D_t> X{D_t(-1)};
// (id, [same as path[i - 2]])
vector<pair<int, int>> path;
// same as path[$ - 1]
int rem = 0;
bool answer() {
if (path.size() >= 1) {
int i = (int)path.size() - 1;
for (; path[i].second; i -= 2) {}
if (i == 0 || (i == 1 && rem)) {
submit(X[path.back().first]);
return true;
}
return false;
} else {
return false;
}
}
} // namespace
bool insert(const D_t &x) {
++Q;
X.push_back(x);
if (path.size() >= 1) {
if (X[path.back().first] == X[Q]) {
int i = (int)path.size() - 1;
for (; path[i].second; i -= 2) {}
if (i == 0) {
++rem;
} else {
path.emplace(path.begin() + (i - 1), Q, (i >= 3 && X[path[i - 3].first] == X[Q]) ? 1 : 0);
path[i].second = 0;
path[i + 1].second = 1;
}
} else {
if (path.size() >= 2) {
path.emplace_back(Q, (X[path[path.size() - 2].first] == X[Q]) ? 1 : 0);
if (rem) {
--rem;
path.emplace_back(path[path.size() - 2].first, 1);
}
} else {
path.emplace_back(Q, 0);
if (rem) {
--rem;
path.emplace_back(path[path.size() - 2].first, 1);
}
}
}
} else {
path.emplace_back(Q, 0);
}
return answer();
}
bool erase(int id) {
// TODO
return answer();
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3788kb
input:
1 100 0 4 0 4 0 1 1 1 0 2 0 2 1 3 1 2 0 2 1 5 0 2 0 3 0 3 0 4 1 8 1 9 1 6 0 1 0 2 0 1 1 11 1 12 0 2 1 13 1 14 1 4 0 2 1 15 0 3 1 16 0 4 0 2 0 2 1 17 1 19 1 7 0 3 1 20 0 4 1 21 0 4 1 22 0 1 0 3 1 23 1 24 0 3 1 25 0 1 0 4 1 26 1 27 0 4 0 1 1 29 1 28 0 4 1 30 0 1 0 3 0 4 0 4 0 3 0 2 1 34 0 4 0 4 0 3 1 ...
output:
QOJ-SECURITYLIB-V23368-nhCapeXC2shGseuHTgYE-bt0m87qTfR8OPcSSLBkv 0 2 1 4 1 4 1 4 1 4 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 1 2 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0...
result:
wrong answer both questions wrong
Subtask #2:
score: 0
Wrong Answer
Test #72:
score: 0
Wrong Answer
time: 2ms
memory: 3912kb
input:
2 5000 0 2 0 1 0 3 1 3 0 4 1 4 0 3 1 5 0 1 0 2 1 7 1 1 0 2 0 3 0 3 1 9 1 8 1 10 0 1 1 11 0 2 0 4 1 12 0 4 0 4 0 3 1 14 1 15 0 1 1 13 0 3 0 3 1 2 0 4 0 3 1 21 0 1 1 22 1 20 1 6 1 16 1 19 0 3 1 23 0 4 0 1 0 1 1 25 1 18 1 17 0 4 0 4 0 1 0 4 0 2 1 31 1 28 1 27 0 4 1 32 1 29 1 26 0 4 1 33 0 2 0 3 1 35 1 ...
output:
QOJ-SECURITYLIB-V23368-nhCapeXC2shGseuHTgYE-bt0m87qTfR8OPcSSLBkv 0 2 1 2 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 ...
result:
wrong answer both questions wrong
Subtask #3:
score: 0
Wrong Answer
Test #143:
score: 0
Wrong Answer
time: 16ms
memory: 4204kb
input:
3 50000 0 2 0 1 0 1 1 1 0 4 1 2 0 1 1 4 0 3 1 6 0 4 1 7 0 1 0 4 1 3 1 8 0 3 0 1 0 2 0 3 1 10 1 13 0 3 0 2 0 1 0 2 1 14 1 17 0 4 0 1 1 18 1 15 1 16 0 4 0 1 1 20 1 21 1 19 1 11 1 5 0 1 0 4 1 23 1 9 0 1 1 24 0 3 0 1 1 25 1 26 0 3 0 3 1 27 1 28 0 1 1 29 0 4 0 4 0 1 1 31 1 30 0 1 1 33 1 32 0 4 0 4 1 34 1...
output:
QOJ-SECURITYLIB-V23368-nhCapeXC2shGseuHTgYE-bt0m87qTfR8OPcSSLBkv 0 2 1 2 0 -1 1 1 1 1 0 -1 0 -1 1 1 1 1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0...
result:
wrong answer both questions wrong
Subtask #4:
score: 0
Wrong Answer
Test #214:
score: 0
Wrong Answer
time: 31ms
memory: 4676kb
input:
4 100000 0 3 0 3 0 3 0 4 0 2 1 4 0 2 0 2 0 3 0 2 0 1 0 2 0 3 0 1 1 7 1 5 1 12 0 2 0 2 1 1 1 10 0 2 1 14 0 3 1 17 0 2 1 8 0 1 0 1 0 4 1 20 1 11 1 6 0 1 1 9 1 21 1 19 1 18 1 22 1 3 1 15 1 16 0 1 0 2 0 2 1 23 0 2 0 2 1 26 0 4 0 4 1 29 1 25 0 4 0 1 0 3 0 2 1 31 1 32 1 24 0 4 1 34 1 27 0 4 0 2 0 1 1 35 0...
output:
QOJ-SECURITYLIB-V23368-nhCapeXC2shGseuHTgYE-bt0m87qTfR8OPcSSLBkv 0 2 1 3 1 3 1 3 1 3 1 3 1 3 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 ...
result:
wrong answer both questions wrong