Submission #126648

#TimeUsernameProblemLanguageResultExecution timeMemory
126648fjzzq2002Space Pirate (JOI14_space_pirate)C++14
10 / 100
2047 ms26568 KiB
#include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <string> #include <bitset> #include <vector> #include <set> #include <map> #include <queue> #include <algorithm> #include <sstream> #include <stack> #include <iomanip> #include <assert.h> using namespace std; #define pb push_back #define mp make_pair typedef pair<int,int> pii; typedef long long ll; typedef double ld; typedef vector<int> vi; #define fi first #define se second #define fe first #define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);} #define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);} #define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);} #define es(x,e) (int e=fst[x];e;e=nxt[e]) #define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e]) #define SZ 666666 int n,a[SZ]; ll k; int go[64][SZ],cnt[SZ]; int cal() { for(int i=1;i<=n;++i) go[0][i]=a[i]; for(int i=1;i<64;++i) for(int j=1;j<=n;++j) go[i][j]=go[i-1][go[i-1][j]]; int u=1; for(int i=61;i>=0;--i) if(k&(1LL<<i)) u=go[i][u]; return u; } int main() { scanf("%d%lld",&n,&k); for(int i=1;i<=n;++i) scanf("%d",a+i); for(int i=1;i<=n;++i) for(int j=1;j<=n;++j) { swap(a[i],j); ++cnt[cal()]; swap(a[i],j); } for(int i=1;i<=n;++i) printf("%d\n",cnt[i]); }

Compilation message (stderr)

space_pirate.cpp: In function 'int main()':
space_pirate.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%lld",&n,&k);
  ~~~~~^~~~~~~~~~~~~~~~
space_pirate.cpp:52:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",a+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...