Submission #938470

#TimeUsernameProblemLanguageResultExecution timeMemory
938470vjudge1Matching (CEOI11_mat)C++17
18 / 100
2059 ms27368 KiB
#include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; int n, m, a[1<<20], b[1<<20]; int z[1<<20], zn; int main() { scanf("%d", &n); scanf("%d", &m); for (int i = 1; i <= n; ++i) scanf("%d", a+i); for (int i = 1; i <= m; ++i) scanf("%d", b+i); for (int i = 1; i + n - 1 <= m; ++i) { vector<pair<int, int> > v; for (int j = i; j < i + n; ++j) v.emplace_back(b[j], j); sort(v.begin(), v.end()); int ok = 1; for (int j = 1; j <= n; ++j) if (v[j-1].second == a[j]+i-1); else ok = 0; if(ok)z [zn++] = i; } printf("%d\n", zn); for (int i = 0; i < zn; ++i) printf("%d ", z[i]); }

Compilation message (stderr)

mat.cpp: In function 'int main()':
mat.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
mat.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &m);
      |     ~~~~~^~~~~~~~~~
mat.cpp:14:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for (int i = 1; i <= n; ++i) scanf("%d", a+i);
      |                                  ~~~~~^~~~~~~~~~~
mat.cpp:15:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for (int i = 1; i <= m; ++i) scanf("%d", b+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...