Submission #743003

#TimeUsernameProblemLanguageResultExecution timeMemory
743003vjudge1Lasers (NOI19_lasers)C++17
21 / 100
1059 ms2388 KiB
#include <bits/stdc++.h> using namespace std; vector<int> wall; const long long maxL = 1e6 + 1; bool walloc[maxL] = {}; int main() { int l, r, amount, a, sum = 0; cin >> l >> r; for (int i = 0; i < r; ++i) { cin >> amount; for (int j = 0; j < amount; ++j) { cin >> a; wall.push_back(a); } if (wall.size() == 1) { if (wall[0] >= l / 2) { int left = l - wall[0]; for (int i = left + 1; i <= l - left; ++i) { if (walloc[i] == false) { walloc[i] = 1; sum++; } } } } else { for (int i = 0; i < wall.size(); ++i) { int otherl = 0, otherr = 0; for (int j = i - 1; j >= 0; --j) otherl += wall[j]; for (int j = i + 1; j < wall.size(); ++j) otherr += wall[j]; int wallleft = l - otherl - otherr; if (wall[i] >= wallleft / 2) { int coverage = wallleft - wall[i]; for (int j = otherl + 1 + coverage; j <= l - otherr - coverage; ++j) { if (walloc[j] == false) { walloc[j] = 1; sum++; } } } } } wall.clear(); } cout << sum; }

Compilation message (stderr)

lasers.cpp: In function 'int main()':
lasers.cpp:36:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             for (int i = 0; i < wall.size(); ++i)
      |                             ~~^~~~~~~~~~~~~
lasers.cpp:41:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |                 for (int j = i + 1; j < wall.size(); ++j)
      |                                     ~~^~~~~~~~~~~~~
#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...