Submission #921495

#TimeUsernameProblemLanguageResultExecution timeMemory
921495Batorgil952Matching (CEOI11_mat)C++14
36 / 100
2052 ms23980 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second using namespace std; const int N=1e6+6; int a[N], b[N], c[N], d[N]; vector< int > v; int main(){ int n, m, i, j, p, vn; scanf("%d",&n); scanf("%d",&m); for(i=1; i<=n; i++){ scanf("%d",&b[i]); c[b[i]]=i; } for(i=1; i<=m; i++){ scanf("%d",&a[i]); } for(i=1; i<=m-n+1; i++){ p=0; for(j=1; j<n; j++){ if(a[b[j]+i-1]>a[b[j+1]+i-1]) p++, j=n; } if(p==0){ v.pb(i); } } vn=v.size(); printf("%d\n", vn); for(i=0; i<vn; i++){ printf("%d ", v[i]); } printf("\n"); return 0; }

Compilation message (stderr)

mat.cpp: In function 'int main()':
mat.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
mat.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%d",&m);
      |  ~~~~~^~~~~~~~~
mat.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   scanf("%d",&b[i]);
      |   ~~~~~^~~~~~~~~~~~
mat.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...