| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1346303 | msb.83 | Kutije (COCI21_kutije) | C++20 | 49 ms | 142812 KiB |
//Rahman ve Rahim olan Allah'ın adıyla
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mid ((st+end)/2)
#define fi first
#define se second
const int INF=1e15+5;
const int E16=1e6;
const int ONE=1;
const int TWO=2;
const int ZERO=0;
const int MOD=1e9+7;//(x+MOD)%MOD
//el.erase(unique(el.begin(),el.end()),el.end());
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int n,m,qry,a;cin>>n>>m>>qry;vector<vector<int>>adj(n);
while(m--){
for(int i=0;i<n;i++){
cin>>a;a--;if(a==i) continue;
adj[a].pb(i);
}
}queue<int>q;vector<vector<bool>>vis(n,vector<bool>(n,false));
for(int i=0;i<n;i++){
q.push(i);
while(!q.empty()){//cerr<<i<<" "<<q.front()<<"\n";
if(vis[i][q.front()]){q.pop();continue;}//cerr<<"1";
int cur=q.front();q.pop();/*cerr<<"1.1";*/vis[i][cur]=true;//cerr<<"2";
for(auto go:adj[cur]){//cerr<<"3";
if(vis[i][go]) continue;
//cerr<<"4";
q.push(go);//cerr<<"5";
}
}
}int b;//cerr<<"not here";
while(qry--){
cin>>a>>b;a--;b--;
if(vis[a][b]){
cout<<"DA\n";
}else{
cout<<"NE\n";
}
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
