# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891525 |
2023-12-23T07:13:14 Z |
Mr_Ph |
Kutije (COCI21_kutije) |
C++17 |
|
1000 ms |
25576 KB |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
const int mod=(int)1e9+7;
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
#define int long long
int can[1002][1002];
vector<vi>adj;
void dfs(int node,int toy)
{
//cout<<node<<" "<<toy<<endl;
can[node][toy]=true;
for(auto i:adj[node])
{
if(!can[i][toy]){
//cout<<"WHAT"<<endl;
dfs(i,toy);
}
}
}
void preprocess() {}
void solve()
{
int n,m,q;
cin>>n>>m>>q;
adj.resize(n+1);
for(int i=0;i<m;i++)
{
for(int j=1;j<=n;j++)
{
int x;
cin>>x;
adj[j].push_back(x);
}
}
for(int i=1;i<=n;i++)dfs(i,i);
while(q--)
{
int a,b;
cin>>a>>b;
if(can[b][a])cout<<"DA"<<endl;
else cout<<"NE"<<endl;
}
}
signed main()
{
// freopen("div7.in","r",stdin);
//freopen("div7.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
preprocess();
//bla();
int t=1;
// cin>>t;
while(t--)
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
13648 KB |
Output is correct |
2 |
Correct |
74 ms |
12368 KB |
Output is correct |
3 |
Correct |
73 ms |
11856 KB |
Output is correct |
4 |
Correct |
121 ms |
13680 KB |
Output is correct |
5 |
Correct |
80 ms |
11640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Output is correct |
2 |
Correct |
1 ms |
832 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
1 ms |
860 KB |
Output is correct |
6 |
Correct |
1 ms |
1112 KB |
Output is correct |
7 |
Correct |
2 ms |
860 KB |
Output is correct |
8 |
Correct |
1 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
992 KB |
Output is correct |
10 |
Correct |
2 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
856 KB |
Output is correct |
2 |
Correct |
1 ms |
832 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
1 ms |
860 KB |
Output is correct |
6 |
Correct |
1 ms |
1112 KB |
Output is correct |
7 |
Correct |
2 ms |
860 KB |
Output is correct |
8 |
Correct |
1 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
992 KB |
Output is correct |
10 |
Correct |
2 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
860 KB |
Output is correct |
13 |
Correct |
2 ms |
860 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1056 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
2 ms |
860 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
860 KB |
Output is correct |
20 |
Correct |
1 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
13648 KB |
Output is correct |
2 |
Correct |
74 ms |
12368 KB |
Output is correct |
3 |
Correct |
73 ms |
11856 KB |
Output is correct |
4 |
Correct |
121 ms |
13680 KB |
Output is correct |
5 |
Correct |
80 ms |
11640 KB |
Output is correct |
6 |
Correct |
1 ms |
856 KB |
Output is correct |
7 |
Correct |
1 ms |
832 KB |
Output is correct |
8 |
Correct |
2 ms |
860 KB |
Output is correct |
9 |
Correct |
2 ms |
860 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
1 ms |
1112 KB |
Output is correct |
12 |
Correct |
2 ms |
860 KB |
Output is correct |
13 |
Correct |
1 ms |
860 KB |
Output is correct |
14 |
Correct |
1 ms |
992 KB |
Output is correct |
15 |
Correct |
2 ms |
860 KB |
Output is correct |
16 |
Correct |
1 ms |
860 KB |
Output is correct |
17 |
Correct |
1 ms |
860 KB |
Output is correct |
18 |
Correct |
2 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
860 KB |
Output is correct |
20 |
Correct |
2 ms |
1056 KB |
Output is correct |
21 |
Correct |
1 ms |
860 KB |
Output is correct |
22 |
Correct |
2 ms |
860 KB |
Output is correct |
23 |
Correct |
1 ms |
860 KB |
Output is correct |
24 |
Correct |
1 ms |
860 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
238 ms |
25576 KB |
Output is correct |
27 |
Correct |
139 ms |
25380 KB |
Output is correct |
28 |
Correct |
889 ms |
22496 KB |
Output is correct |
29 |
Correct |
598 ms |
24916 KB |
Output is correct |
30 |
Correct |
107 ms |
20320 KB |
Output is correct |
31 |
Correct |
132 ms |
22488 KB |
Output is correct |
32 |
Execution timed out |
1070 ms |
20616 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |