| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1346446 | msb.83 | Kutije (COCI21_kutije) | C++20 | 1095 ms | 11404 KiB |
//Rahman ve Rahim olan Allah'ın adıyla
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll_loops")
#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);
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()){
if(vis[i][q.front()]){q.pop();continue;}
int cur=q.front();q.pop();vis[i][cur]=true;
for(auto go:adj[cur]){
if(vis[i][go]) continue;
q.push(go);
}
}
}int b;
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... | ||||
