QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54269 | #121. Bitaro's Party | prxms | Compile Error | / | / | C++ | 2.6kb | 2022-10-07 18:29:23 | 2022-10-07 18:29:27 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-10-07 18:29:27]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-10-07 18:29:23]
- 提交
answer
include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int SQ = 320;
vector<int> g[maxn];
vector<pair<int , int> > BSQ[maxn];
bool vis[maxn] , mark[maxn];
int n , m , q;
void relax(int v){
for(int u : g[v]){
vector<pair<int , int> > vec;
while(!BSQ[v].empty()){
vec.push_back(BSQ[v].back());
BSQ[v].pop_back();
}
int jv = 0 , ju = 0;
while(ju < (int)BSQ[u].size() && jv < (int)vec.size() && BSQ[v].size() < SQ){
while(ju < (int)BSQ[u].size() && vis[BSQ[u][ju].second])
ju++;
while(jv < (int)vec.size() && vis[vec[jv].second])
jv++;
if(ju == (int)BSQ[u].size() || jv == (int)vec.size())
break;
if(BSQ[u][ju].first + 1 > vec[jv].first){
BSQ[v].push_back({BSQ[u][ju].first + 1 , BSQ[u][ju].second});
vis[BSQ[u][ju].second] = true;
ju++;
}
else{
BSQ[v].push_back(vec[jv]);
vis[vec[jv].second] = true;
jv++;
}
}
while(ju < (int)BSQ[u].size() && BSQ[v].size() < SQ){
while(ju < (int)BSQ[u].size() && vis[BSQ[u][ju].second])
ju++;
if(ju == (int)BSQ[u].size())
break;
BSQ[v].push_back({BSQ[u][ju].first + 1 , BSQ[u][ju].second});
ju++;
}
while(jv < (int)vec.size() && BSQ[v].size() < SQ){
while(jv < (int)vec.size() && vis[vec[jv].second])
jv++;
if(jv == (int)vec.size())
break;
BSQ[v].push_back(vec[jv]);
jv++;
}
if(BSQ[v].size() < SQ && !vis[u]){
BSQ[v].push_back({1 , u});
vis[u] = true;
}
for(auto i : BSQ[v])
vis[i.second] = false;
}
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> m >> q;
for(int i = 0 ; i < m ; i++){
int u , v;
cin >> u >> v;
g[v].push_back(u);
}
for(int i = 1 ; i <= n ; i++)
relax(i);
while(q--){
int ver , k;
cin >> ver >> k;
vector<int> in;
for(int i = 0 ; i < k ; i++){
int x;
cin >> x;
in.push_back(x);
mark[x] = true;
}
if(k < SQ){
int ans = -1;
for(auto i : BSQ[ver]){
if(!mark[i.second]){
ans = max(ans , i.first);
}
}
if(ans == -1){
if(mark[ver]){
cout << -1 << '\n';
}
else{
cout << 0 << '\n';
}
}
else{
cout << ans << '\n';
}
}
else{
int dp[ver + 1];
for(int i = 1 ; i <= ver ; i++){
dp[i] = 0;
for(int u : g[i]){
if(dp[u] == -1) continue;
dp[i] = max(dp[i] , dp[u] + 1);
}
if(dp[i] == 0 && mark[i]){
dp[i] = -1;
}
}
cout << dp[ver] << '\n';
}
for(int i : in)
mark[i] = false;
}
return 0;
}
Details
answer.code:1:1: error: ‘include’ does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ answer.code:6:1: error: ‘vector’ does not name a type 6 | vector<int> g[maxn]; | ^~~~~~ answer.code:7:1: error: ‘vector’ does not name a type 7 | vector<pair<int , int> > BSQ[maxn]; | ^~~~~~ answer.code: In function ‘void relax(int)’: answer.code:12:21: error: ‘g’ was not declared in this scope 12 | for(int u : g[v]){ | ^ answer.code:13:17: error: ‘vector’ was not declared in this scope 13 | vector<pair<int , int> > vec; | ^~~~~~ answer.code:13:24: error: ‘pair’ was not declared in this scope 13 | vector<pair<int , int> > vec; | ^~~~ answer.code:13:29: error: expected primary-expression before ‘int’ 13 | vector<pair<int , int> > vec; | ^~~ answer.code:14:24: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 14 | while(!BSQ[v].empty()){ | ^~~ | SQ answer.code:15:25: error: ‘vec’ was not declared in this scope 15 | vec.push_back(BSQ[v].back()); | ^~~ answer.code:20:33: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 20 | while(ju < (int)BSQ[u].size() && jv < (int)vec.size() && BSQ[v].size() < SQ){ | ^~~ | SQ answer.code:20:60: error: ‘vec’ was not declared in this scope 20 | while(ju < (int)BSQ[u].size() && jv < (int)vec.size() && BSQ[v].size() < SQ){ | ^~~ answer.code:39:33: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 39 | while(ju < (int)BSQ[u].size() && BSQ[v].size() < SQ){ | ^~~ | SQ answer.code:48:33: error: ‘vec’ was not declared in this scope 48 | while(jv < (int)vec.size() && BSQ[v].size() < SQ){ | ^~~ answer.code:48:47: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 48 | while(jv < (int)vec.size() && BSQ[v].size() < SQ){ | ^~~ | SQ answer.code:57:20: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 57 | if(BSQ[v].size() < SQ && !vis[u]){ | ^~~ | SQ answer.code:62:30: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 62 | for(auto i : BSQ[v]) | ^~~ | SQ answer.code: In function ‘int main()’: answer.code:68:9: error: ‘ios’ has not been declared 68 | ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); | ^~~ answer.code:68:38: error: ‘cin’ was not declared in this scope 68 | ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); | ^~~ answer.code:68:50: error: ‘cout’ was not declared in this scope 68 | ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); | ^~~~ answer.code:73:17: error: ‘g’ was not declared in this scope 73 | g[v].push_back(u); | ^ answer.code:82:17: error: ‘vector’ was not declared in this scope 82 | vector<int> in; | ^~~~~~ answer.code:82:24: error: expected primary-expression before ‘int’ 82 | vector<int> in; | ^~~ answer.code:86:25: error: ‘in’ was not declared in this scope; did you mean ‘i’? 86 | in.push_back(x); | ^~ | i answer.code:92:38: error: ‘BSQ’ was not declared in this scope; did you mean ‘SQ’? 92 | for(auto i : BSQ[ver]){ | ^~~ | SQ answer.code:94:47: error: ‘max’ was not declared in this scope; did you mean ‘maxn’? 94 | ans = max(ans , i.first); | ^~~ | maxn answer.code:114:45: error: ‘g’ was not declared in this scope 114 | for(int u : g[i]){ | ^ answer.code:116:49: error: ‘max’ was not declared in this scope; did you mean ‘maxn’? 116 | dp[i] = max(dp[i] , dp[u] + 1); | ...