結果
| 問題 | No.3390 Public or Private |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-28 23:19:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,478 bytes |
| コンパイル時間 | 2,820 ms |
| コンパイル使用メモリ | 206,680 KB |
| 実行使用メモリ | 125,820 KB |
| 最終ジャッジ日時 | 2025-11-28 23:20:07 |
| 合計ジャッジ時間 | 11,889 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 5 RE * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i=(s); i<(int)(n); i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vs=vector<string>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vvvl=vector<vvl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pi=pair<int,int>;
using pl=pair<ll,ll>;
using si=set<int>;
using vsi=vector<si>;
using sl=set<ll>;
using vsl=vector<sl>;
using ss=set<string>;
using svi=set<vi>;
using svl=set<vl>;
using svs=set<vs>;
using sb=set<bool>;
using vpi=vector<pi>;
using vpl=vector<pl>;
using spi=set<pi>;
using spl=set<pl>;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
template<typename T> using pq=priority_queue<T>;
int f(int a){
return a*a*a-a*a+a+1;
}
bool isprime(int a){
for(int i=2;i*i<=a;i++){
if(a%i==0)return false;
}
return true;
}
int main() {//1-indexed
ll n,m;
cin>>n>>m;
vvb G(n+1,vb(n+1,false));
rep(i,m){
ll u,v;
cin>>u>>v;
G[u][v]=true;
}
si close;
ll Q;
cin>>Q;
while(Q--){
ll q,a,b;
cin>>q>>a>>b;
if(q==1){
if(G[a][b]){
G[a][b]=false;
}else G[a][b]=true;
}else{
if(!close.count(a))close.insert(a);
else close.erase(a);
}
ll nans=close.size();
for(ll i:close){
if(G[a][i])nans--;
}
cout<<n-nans-(close.count(a)?-1:0)-1<<'\n';
}
}