제출 #821078

#제출 시각아이디문제언어결과실행 시간메모리
821078boris_mihovMarshmallow Molecules (CCO19_day2problem2)C++17
5 / 25
4083 ms177980 KiB
#include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <vector> #include <bitset> #include <queue> #include <stack> #include <set> #include <map> typedef long long llong; const int MAXN = 100000 + 10; const llong INF = 1e18; const int INTINF = 1e9; int n, m; std::bitset <MAXN> bs[MAXN]; void solve() { llong cnt = 0; for (int i = 1 ; i <= n ; ++i) { std::bitset <MAXN> toOR; for (int j = i - 1 ; j >= 1 ; --j) { if (bs[j][i]) { toOR |= bs[j]; } } bs[i] |= (toOR >> i + 1) << i + 1; cnt += bs[i].count(); if (((bs[i] >> i + 1) << i + 1).count() == n - i) { cnt += 1LL * (n - i) * (n - i - 1) / 2; break; } } std::cout << cnt << '\n'; } void input() { std::cin >> n >> m; for (int i = 1 ; i <= m ; ++i) { int u, v; std::cin >> u >> v; bs[u][v] = 1; } } void fastIOI() { std::ios_base :: sync_with_stdio(0); std::cout.tie(nullptr); std::cin.tie(nullptr); } int main() { fastIOI(); input(); solve(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void solve()':
Main.cpp:34:29: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |         bs[i] |= (toOR >> i + 1) << i + 1;
      |                           ~~^~~
Main.cpp:36:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   36 |         if (((bs[i] >> i + 1) << i + 1).count() == n - i)
      |                        ~~^~~
Main.cpp:36:49: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |         if (((bs[i] >> i + 1) << i + 1).count() == n - 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...