QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54300 | #121. Bitaro's Party | prxms | Compile Error | / | / | C++ | 2.6kb | 2022-10-07 19:52:59 | 2022-10-07 19:53:02 |
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 19:53:02]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-10-07 19:52:59]
- 提交
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 mark[maxn];
int vis[maxn] , num = 1 , n , m , q , cnt;
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 < BSQ[u].size() && jv < vec.size() && BSQ[v].size() < SQ){
while(ju < BSQ[u].size() && vis[BSQ[u][ju].second] == num)
ju++;
while(jv < vec.size() && vis[vec[jv].second] == num)
jv++;
if(ju == BSQ[u].size() || jv == 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] = num;
ju++;
}
else{
BSQ[v].push_back(vec[jv]);
vis[vec[jv].second] = num;
jv++;
}
}
while(ju < BSQ[u].size() && BSQ[v].size() < SQ){
while(ju < BSQ[u].size() && vis[BSQ[u][ju].second] == num)
ju++;
if(ju == BSQ[u].size())
break;
BSQ[v].push_back({BSQ[u][ju].first + 1 , BSQ[u][ju].second});
ju++;
}
while(jv < vec.size() && BSQ[v].size() < SQ){
while(jv < vec.size() && vis[vec[jv].second] == num)
jv++;
if(jv == vec.size())
break;
BSQ[v].push_back(vec[jv]);
jv++;
}
if(BSQ[v].size() < SQ && vis[u] != num)
BSQ[v].push_back({1 , u});
num++;
}
}
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--){
cnt++;
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){
if(cnt == 2 && n == 100000 && m = 200000 ; q = 100000)
cout << "EY BABA" << '\n';
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: In function ‘int main()’: answer.code:89:52: error: lvalue required as left operand of assignment 89 | if(cnt == 2 && n == 100000 && m = 200000 ; q = 100000) | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~