답안 #642249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642249 2022-09-19T03:39:55 Z christinelynn Lasers (NOI19_lasers) C++17
24 / 100
158 ms 59176 KB
#include <bits/stdc++.h>
using namespace std;

#define nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define otsumiko exit(0);
#define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >
#define mikochi priority_queue<long long, vector<long long>, greater<long long> >

long long l, r, x, ao = 1, wd, ans, ca, cl, cr, cs, sl[500069], sx = 0;
vector<long long> wl[500069], ps[500069];

int main() {
  nyahalo
  long long i, j, ii;
  cin >> l >> r;
  for (i=1; i<=r; i++) {
    cin >> x;
    sx += x;
    cs = 0;
    ps[i].push_back(0);
    for (j=1; j<=x; j++) {
      cin >> wd;
      cs += wd;
      wl[i].push_back(wd);
      ps[i].push_back(cs);
    }
    sl[i] = cs;
    if (x != 1) {
      ao = 0;
    }
  }
  if (ao == 1) {
    ans = 0;
    for (i=1; i<=r; i++) {
      wd = wl[i][0];
      cr = wd;
      cl = l-wd+1;
      ca = max(0ll, cr-cl+1);
      ans = max(ans, ca);
    }
    cout << ans << "\n";
    otsumiko
  }
  if ((r == 2 && l<=1000000) || (l<=1000 && sx<=1000)) {
    ans = 0;
    for (i=1; i<=r; i++) {
      ca = 0;
      for (j=1; j<=l; j++) {
        cl = *(lower_bound(ps[i].begin(), ps[i].end(), j)-1);
        cr = sl[i]-cl;
        cr = l+1-cr;
        if (cr<=j) {
          ca++;
        }
      }
      ans = max(ans, ca);
    }
    cout << ans << "\n";
    otsumiko
  }
  cout << "sek\n";
  otsumiko
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:14:19: warning: unused variable 'ii' [-Wunused-variable]
   14 |   long long i, j, ii;
      |                   ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23768 KB Output is correct
3 Correct 11 ms 23764 KB Output is correct
4 Correct 14 ms 23740 KB Output is correct
5 Correct 12 ms 23812 KB Output is correct
6 Correct 14 ms 23764 KB Output is correct
7 Correct 11 ms 23816 KB Output is correct
8 Correct 14 ms 23892 KB Output is correct
9 Correct 11 ms 23764 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23768 KB Output is correct
3 Correct 11 ms 23764 KB Output is correct
4 Correct 14 ms 23740 KB Output is correct
5 Correct 12 ms 23812 KB Output is correct
6 Correct 14 ms 23764 KB Output is correct
7 Correct 11 ms 23816 KB Output is correct
8 Correct 14 ms 23892 KB Output is correct
9 Correct 11 ms 23764 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 12 ms 23872 KB Output is correct
12 Correct 146 ms 58700 KB Output is correct
13 Correct 15 ms 23764 KB Output is correct
14 Correct 14 ms 23816 KB Output is correct
15 Correct 13 ms 23824 KB Output is correct
16 Correct 12 ms 23824 KB Output is correct
17 Correct 158 ms 59176 KB Output is correct
18 Correct 12 ms 23764 KB Output is correct
19 Correct 13 ms 23816 KB Output is correct
20 Correct 11 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 81 ms 31084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 23704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 81 ms 31084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23768 KB Output is correct
3 Correct 11 ms 23764 KB Output is correct
4 Correct 14 ms 23740 KB Output is correct
5 Correct 12 ms 23812 KB Output is correct
6 Correct 14 ms 23764 KB Output is correct
7 Correct 11 ms 23816 KB Output is correct
8 Correct 14 ms 23892 KB Output is correct
9 Correct 11 ms 23764 KB Output is correct
10 Correct 11 ms 23764 KB Output is correct
11 Correct 12 ms 23872 KB Output is correct
12 Correct 146 ms 58700 KB Output is correct
13 Correct 15 ms 23764 KB Output is correct
14 Correct 14 ms 23816 KB Output is correct
15 Correct 13 ms 23824 KB Output is correct
16 Correct 12 ms 23824 KB Output is correct
17 Correct 158 ms 59176 KB Output is correct
18 Correct 12 ms 23764 KB Output is correct
19 Correct 13 ms 23816 KB Output is correct
20 Correct 11 ms 23764 KB Output is correct
21 Incorrect 81 ms 31084 KB Output isn't correct
22 Halted 0 ms 0 KB -