답안 #1083503

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083503 2024-09-03T10:47:19 Z modwwe Paths (BOI18_paths) C++17
100 / 100
165 ms 95896 KB
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
#define int long long
//#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP     ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe  int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".ans","w",stdout)
#define pb push_back
#define checktime   cerr << (double)clock() / CLOCKS_PER_SEC * 1000  << " ms";
using namespace std;
#define getchar_unlocked getchar

inline int scan()
{
    char c = getchar_unlocked();
    int x = 0;
    while(c<'0'||c>'9')
    {
        c=getchar_unlocked();
    }
    while(c>='0'&&c<='9')
    {
        x=(x<<1)+(x<<3)+c-'0';
        c=getchar_unlocked();
    }
    return x;
}

void phongbeo();
const int inf=1e9;
const int mod2=998244353;
const int  mod1=998244353;
struct icd
{
    long double a;
    int b;
};
struct ib
{
    int a;
    int b;
};
struct ic
{
    int a,b,c;
};
struct id
{
    int a,b,c,d;
};
struct ie
{
    int a,b,c,d,e;

};

int n,m,s1,s2,s4,s3,sf,k,s5,s6,mx,s7,s8,s9,mx2,res,dem2=0,dem=0,s33,dem3,dem4,l,r,mid,l2,r2;
int  i,s10,s12;
int kk;
int el=29;
main()
{
#ifndef ONLINE_JUDGE
  //  fin(task);
    //fou(task);
#endif
    NHP
    /// cin>>s1;
    //modwwe
    phongbeo();
//checktime
}
int dp[300001][32];
int a[300001];
vector<int> v[300001];
void phongbeo()
{
n=scan();
m=scan();
k=scan();
  for(int i=1;i<=n;i++)
 a[i]=scan(),a[i]--,dp[i][(1<<a[i])]=1;
  for(int i=1;i<=m;i++)
     l=scan(),r=scan(),v[l].pb(r),v[r].pb(l);
     for(int j=1;j<(1<<k);j++)
   for(int i=1;i<=n;i++){
    if(dp[i][j]==0) continue;
         for(auto k:v[i])
             if(!bit(j,a[k])){
             dp[k][j+(1<<a[k])]+=dp[i][j];
             }
             s4+=dp[i][j];
        }
         cout<<s4-n;
}

Compilation message

paths.cpp:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   67 | main()
      | ^~~~
paths.cpp: In function 'void phongbeo()':
paths.cpp:89:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   89 |   for(int i=1;i<=m;i++)
      |   ^~~
paths.cpp:91:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   91 |      for(int j=1;j<(1<<k);j++)
      |      ^~~
paths.cpp:94:10: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   94 |          for(auto k:v[i])
      |          ^~~
paths.cpp:98:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   98 |              s4+=dp[i][j];
      |              ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 10840 KB Output is correct
2 Correct 2 ms 10844 KB Output is correct
3 Correct 2 ms 10844 KB Output is correct
4 Correct 4 ms 10844 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 3 ms 10844 KB Output is correct
7 Correct 2 ms 11096 KB Output is correct
8 Correct 3 ms 10844 KB Output is correct
9 Correct 2 ms 10844 KB Output is correct
10 Correct 2 ms 10856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 18264 KB Output is correct
2 Correct 23 ms 17756 KB Output is correct
3 Correct 134 ms 95312 KB Output is correct
4 Correct 39 ms 25424 KB Output is correct
5 Correct 35 ms 25460 KB Output is correct
6 Correct 103 ms 68800 KB Output is correct
7 Correct 116 ms 95376 KB Output is correct
8 Correct 130 ms 95868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 10840 KB Output is correct
2 Correct 2 ms 10844 KB Output is correct
3 Correct 2 ms 10844 KB Output is correct
4 Correct 4 ms 10844 KB Output is correct
5 Correct 2 ms 10844 KB Output is correct
6 Correct 3 ms 10844 KB Output is correct
7 Correct 2 ms 11096 KB Output is correct
8 Correct 3 ms 10844 KB Output is correct
9 Correct 2 ms 10844 KB Output is correct
10 Correct 2 ms 10856 KB Output is correct
11 Correct 32 ms 18264 KB Output is correct
12 Correct 23 ms 17756 KB Output is correct
13 Correct 134 ms 95312 KB Output is correct
14 Correct 39 ms 25424 KB Output is correct
15 Correct 35 ms 25460 KB Output is correct
16 Correct 103 ms 68800 KB Output is correct
17 Correct 116 ms 95376 KB Output is correct
18 Correct 130 ms 95868 KB Output is correct
19 Correct 29 ms 18264 KB Output is correct
20 Correct 28 ms 17856 KB Output is correct
21 Correct 132 ms 95280 KB Output is correct
22 Correct 40 ms 25424 KB Output is correct
23 Correct 36 ms 25424 KB Output is correct
24 Correct 88 ms 68800 KB Output is correct
25 Correct 119 ms 95312 KB Output is correct
26 Correct 133 ms 95896 KB Output is correct
27 Correct 33 ms 18012 KB Output is correct
28 Correct 43 ms 21520 KB Output is correct
29 Correct 165 ms 95324 KB Output is correct
30 Correct 107 ms 56004 KB Output is correct
31 Correct 108 ms 56288 KB Output is correct
32 Correct 163 ms 95520 KB Output is correct
33 Correct 2 ms 10840 KB Output is correct
34 Correct 2 ms 10852 KB Output is correct
35 Correct 2 ms 10844 KB Output is correct
36 Correct 3 ms 10844 KB Output is correct
37 Correct 2 ms 10844 KB Output is correct
38 Correct 2 ms 10840 KB Output is correct
39 Correct 2 ms 10844 KB Output is correct
40 Correct 2 ms 10844 KB Output is correct
41 Correct 3 ms 10844 KB Output is correct
42 Correct 2 ms 10840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10840 KB Output is correct
2 Correct 18 ms 12892 KB Output is correct
3 Correct 9 ms 12892 KB Output is correct
4 Correct 40 ms 38192 KB Output is correct
5 Correct 31 ms 38608 KB Output is correct
6 Correct 57 ms 38216 KB Output is correct
7 Correct 13 ms 12892 KB Output is correct
8 Correct 46 ms 38400 KB Output is correct
9 Correct 35 ms 38608 KB Output is correct
10 Correct 38 ms 38988 KB Output is correct
11 Correct 39 ms 24784 KB Output is correct
12 Correct 30 ms 31564 KB Output is correct
13 Correct 33 ms 25172 KB Output is correct
14 Correct 55 ms 38236 KB Output is correct
15 Correct 52 ms 38228 KB Output is correct
16 Correct 2 ms 10844 KB Output is correct
17 Correct 2 ms 10844 KB Output is correct
18 Correct 3 ms 10904 KB Output is correct
19 Correct 2 ms 10840 KB Output is correct
20 Correct 2 ms 10844 KB Output is correct
21 Correct 2 ms 10844 KB Output is correct
22 Correct 2 ms 10844 KB Output is correct
23 Correct 2 ms 10844 KB Output is correct
24 Correct 2 ms 10844 KB Output is correct
25 Correct 2 ms 10844 KB Output is correct