Submission details
Task:Illuminati
Sender:hundlij1
Submission time:2025-10-27 17:32:19 +0200
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'void task4()':
input/code.cpp:22:14: error: uninitialized 'const n' [-fpermissive]
   22 |     const ll n;
      |              ^
input/code.cpp:23:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'const ll' {aka 'const long long int'})
   23 |     cin >> n;
      |     ~~~ ^~ ~
      |     |      |
      |     |      const ll {aka const long long int}
      |     std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/11/iostream:40,
                 from input/code.cpp:1:
/usr/include/c++/11/istream:120:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]' (near...

Code

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <climits>
#include <map>
#include <set>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;




void task4()
{

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    const ll n;
    cin >> n;
    vector<bitset<n>> adj(n);
    for(ll i = 0; i < n; i++){
        string s;
        cin >> s;

        for(ll j = 0; j < n; j++){
            if(s[j] == '1'){
                adj[i][j] = 1,
                adj[j][i] = 1;
            }
        }
    }

    ll res = 0;

    for (int i = 0; i < n;i++){
        for (int j = 0; j < n;j++){
            if(adj[i][j] == 1 && i != j){
                bitset<n> andMatrix = adj[i] & adj[j];
                res += andMatrix.count();
            }
        }
    }


   cout << res / 6 << endl;

   
    
}


ll swaps(vector<ll> &arr) {
    
    vector<ll> nums(arr.begin(), arr.end());
    sort(nums.begin(), nums.end());
    
  	unordered_map<ll, ll> pos; 
    for(int i = 0; i < arr.size(); i++){
        pos[arr[i]] = i;
    }
        
  	ll numChanges = 0;
    for(ll i = 0; i < arr.size(); i++) {
        if(nums[i] != arr[i]) {
            ll ind = pos[nums[i]];
            swap(arr[i], arr[ind]);

            pos[arr[i]] = i; 
            pos[arr[ind]] = ind;
            
            numChanges++; 
        }
    }
    return numChanges; 
}


void task3(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n;
    cin >> n;
    vector<ll> arr(n);
    for(ll i = 0; i < n; i++){
        cin >> arr[i];
    }
    
    cout << swaps(arr) << endl;

}

int main() {
    task4();

}