CSES - Aalto Competitive Programming 2024 - wk8 - Mon - Results
Submission details
Task:Illuminati
Sender:esya_rae
Submission time:2024-10-28 17:30:39 +0200
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:16:13: error: 'bitset' was not declared in this scope
   16 |     vector <bitset<3000>> b;
      |             ^~~~~~
input/code.cpp:5:1: note: 'std::bitset' is defined in header '<bitset>'; did you forget to '#include <bitset>'?
    4 | #include <tuple>
  +++ |+#include <bitset>
    5 | using namespace std;
input/code.cpp:16:20: error: template argument 1 is invalid
   16 |     vector <bitset<3000>> b;
      |                    ^~~~
input/code.cpp:16:20: error: template argument 2 is invalid
input/code.cpp:16:24: error: expected unqualified-id before '>' token
   16 |     vector <bitset<3000>> b;
      |                        ^~
input/code.cpp:23:22: error: 'bb' was not declared in this scope
   23 |         bitset<3000> bb(a);
      |                      ^~
input/code.cpp:24:9: error: 'b' was not declared in this scope
   24 |         b.push_back(bb);
      |         ^
input/code.cpp:27:18: error: 'bb' was not declared in th...

Code

#include <iostream>
#include <cmath>
#include <vector>
#include <tuple>
using namespace std;
#include <iostream>



int main()
{
    int n;
    cin >> n;
    vector< string> x;
    vector< vector < int>> x2(n);
    vector <bitset<3000>> b;

    string a;


    for (int i = 0; i < n; i++) {
        cin >> a;
        bitset<3000> bb(a);
        b.push_back(bb);
        x.push_back(a);
    }
    bitset<3000> bb;
    long long res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (x[i][j] == '1') {
                res += (b[i] & b[j]).count();

            }
        }
    }
    cout << res / 6 << endl;
}