Submission #1007949

# Submission time Handle Problem Language Result Execution time Memory
1007949 2024-06-26T02:52:30 Z andecaandeci Lasers (NOI19_lasers) C++17
87 / 100
67 ms 12372 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[1000005];
signed main()
{
  int n, q;
  scanf("%lld %lld", &n, &q);
  if(n<=1000000)
  {
    int ans=0;
    for(int i=1; i<=q; i++)
    {
      int k;
      scanf("%lld", &k);
      int l[k+5], pre[k+5];pre[0]=0;
      for(int j=1; j<=k; j++)
      {
        scanf("%lld", &l[j]);
        pre[j]=pre[j-1]+l[j];
      }
      int gap=n-pre[k];
      for(int i=0; i<k; i++)
      {
        if(pre[i]+gap+1<=pre[i+1]+1)
        {
          a[pre[i]+gap+1]++;
        a[pre[i+1]+1]--;  
        }
//          printf("%lld %lld\n", pre[i]+gap+1, pre[i+1]+1);
      }  
    }
    for(int i=1; i<=n; i++)
    {
      a[i]+=a[i-1];
      if(a[i]<=0)
      {
//        printf("%lld\n", i);
        ans++;
      }
    }
    printf("%lld\n", n-ans);
  }
  else
  {
    int ans=0;
    for(int i=1; i<=q; i++)
    {
      int k;
      scanf("%lld", &k);
      for(int j=1; j<=k; j++)
      {
        int p;
        scanf("%lld", &p);
        ans=max(ans, 2*p-n);
      }
    }
    printf("%lld\n", ans);
  }
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%lld %lld", &n, &q);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~
lasers.cpp:15:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |       scanf("%lld", &k);
      |       ~~~~~^~~~~~~~~~~~
lasers.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%lld", &l[j]);
      |         ~~~~~^~~~~~~~~~~~~~~
lasers.cpp:50:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |       scanf("%lld", &k);
      |       ~~~~~^~~~~~~~~~~~
lasers.cpp:54:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         scanf("%lld", &p);
      |         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 67 ms 416 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 53 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 9780 KB Output is correct
2 Correct 6 ms 8580 KB Output is correct
3 Correct 7 ms 8536 KB Output is correct
4 Correct 22 ms 10328 KB Output is correct
5 Correct 10 ms 10076 KB Output is correct
6 Correct 22 ms 12372 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 35 ms 10844 KB Output is correct
9 Correct 11 ms 9052 KB Output is correct
10 Correct 21 ms 10332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 9780 KB Output is correct
2 Correct 6 ms 8580 KB Output is correct
3 Correct 7 ms 8536 KB Output is correct
4 Correct 22 ms 10328 KB Output is correct
5 Correct 10 ms 10076 KB Output is correct
6 Correct 22 ms 12372 KB Output is correct
7 Correct 2 ms 6744 KB Output is correct
8 Correct 35 ms 10844 KB Output is correct
9 Correct 11 ms 9052 KB Output is correct
10 Correct 21 ms 10332 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 63 ms 7000 KB Output is correct
22 Correct 10 ms 7612 KB Output is correct
23 Correct 8 ms 8028 KB Output is correct
24 Correct 27 ms 8948 KB Output is correct
25 Correct 60 ms 7004 KB Output is correct
26 Correct 18 ms 7256 KB Output is correct
27 Correct 8 ms 7512 KB Output is correct
28 Correct 60 ms 7004 KB Output is correct
29 Correct 64 ms 7256 KB Output is correct
30 Correct 30 ms 8280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 67 ms 416 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 53 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 18 ms 9780 KB Output is correct
22 Correct 6 ms 8580 KB Output is correct
23 Correct 7 ms 8536 KB Output is correct
24 Correct 22 ms 10328 KB Output is correct
25 Correct 10 ms 10076 KB Output is correct
26 Correct 22 ms 12372 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 35 ms 10844 KB Output is correct
29 Correct 11 ms 9052 KB Output is correct
30 Correct 21 ms 10332 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 63 ms 7000 KB Output is correct
42 Correct 10 ms 7612 KB Output is correct
43 Correct 8 ms 8028 KB Output is correct
44 Correct 27 ms 8948 KB Output is correct
45 Correct 60 ms 7004 KB Output is correct
46 Correct 18 ms 7256 KB Output is correct
47 Correct 8 ms 7512 KB Output is correct
48 Correct 60 ms 7004 KB Output is correct
49 Correct 64 ms 7256 KB Output is correct
50 Correct 30 ms 8280 KB Output is correct
51 Incorrect 8 ms 348 KB Output isn't correct
52 Halted 0 ms 0 KB -