Submission #579432

#TimeUsernameProblemLanguageResultExecution timeMemory
579432juggernautAmusement Park (CEOI19_amusementpark)C++14
19 / 100
137 ms19580 KiB
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; typedef long long ll; typedef long double ld; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef juggernaut #define printl(args...) printf(args) #else #define printl(args...) 0 #endif int x[999],y[999]; ll mod=998244353; int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=0;i^m;i++)scanf("%d%d",&x[i],&y[i]); unordered_set<ll>st; vector<int>vec(n); iota(vec.begin(),vec.end(),1); ll ans=0; do{ ll tmp=0; for(int i=0;i^m;i++)tmp|=ll(vec[x[i]-1]<vec[y[i]-1])<<i; if(!st.count(tmp)){ st.insert(tmp); ans+=__builtin_popcount(tmp); } }while(next_permutation(vec.begin(),vec.end())); ans%=mod; cout<<ans; }

Compilation message (stderr)

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
amusementpark.cpp:25:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  for(int i=0;i^m;i++)scanf("%d%d",&x[i],&y[i]);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...