Submission #797110

# Submission time Handle Problem Language Result Execution time Memory
797110 2023-07-29T06:52:47 Z vjudge1 Making Friends on Joitter is Fun (JOI20_joitter2) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<vector>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define fi first
#define se second
using namespace std ;
const ll NS = 50 ;
short ans ;
bool us[NS + 1][NS + 1] ;
vector<int> v[NS + 1], v1[NS + 1] ;
signed main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    short n, m ;
    cin >> n >> m ;
    if(n <= 50)
    {
        vector<pair<int, int>> pr ;
        while(m--)
        {
            short a, b ;
            cin >> a >> b ;
            if(!us[a][b])
            {
                ans++ ;
                us[a][b] = 1 ;
//                cout << a<<"->"<< b << '\n' ;
                v[a].push_back(b) ;
                v1[b].push_back(a) ;
                if(us[b][a])pr.push_back({a, b}) ;
            }
            bool flag = 1 ;
            while(flag)
            {
                flag = 0 ;
                for(auto i : pr)
                {
                    int y = i.fi, z = i.se ;
                    for(int j : v1[y])
                        if(j != z && !us[j][z])
                        {
                            ans++ ;
                            flag = 1 ;
//                            cout << j<<"->"<< z << '\n' ;
                            v[j].push_back(z) ;
                            v1[z].push_back(j) ;
                            us[j][z] = 1 ;
                            if(us[j][z] && us[z][j])
                                pr.push_back({j, z}) ;
                        }
                    for(int j : v1[z])
                        if(j != y && !us[j][y])
                        {
                            ans++ ;
                            flag = 1 ;
//                            cout << j<<"->"<< y << '\n' ;
                            v[j].push_back(y) ;
                            v1[y].push_back(j) ;
                            us[j][y] = 1 ;
                            if(us[j][y] && us[y][j])
                                pr.push_back({j, y}) ;
                        }
                }
            }
            cout << ans << '\n';
        }
        return 0 ;
    }
    return 0 ;
}

Compilation message

joitter2.cpp:8:7: error: 'll' does not name a type
    8 | const ll NS = 50 ;
      |       ^~
joitter2.cpp:10:9: error: 'NS' was not declared in this scope
   10 | bool us[NS + 1][NS + 1] ;
      |         ^~
joitter2.cpp:10:17: error: 'NS' was not declared in this scope
   10 | bool us[NS + 1][NS + 1] ;
      |                 ^~
joitter2.cpp:11:15: error: 'NS' was not declared in this scope
   11 | vector<int> v[NS + 1], v1[NS + 1] ;
      |               ^~
joitter2.cpp:11:27: error: 'NS' was not declared in this scope
   11 | vector<int> v[NS + 1], v1[NS + 1] ;
      |                           ^~
joitter2.cpp: In function 'int main()':
joitter2.cpp:26:17: error: 'us' was not declared in this scope
   26 |             if(!us[a][b])
      |                 ^~
joitter2.cpp:31:17: error: 'v' was not declared in this scope
   31 |                 v[a].push_back(b) ;
      |                 ^
joitter2.cpp:32:17: error: 'v1' was not declared in this scope
   32 |                 v1[b].push_back(a) ;
      |                 ^~
joitter2.cpp:42:33: error: 'v1' was not declared in this scope
   42 |                     for(int j : v1[y])
      |                                 ^~
joitter2.cpp:43:39: error: 'us' was not declared in this scope
   43 |                         if(j != z && !us[j][z])
      |                                       ^~
joitter2.cpp:48:29: error: 'v' was not declared in this scope
   48 |                             v[j].push_back(z) ;
      |                             ^
joitter2.cpp:54:33: error: 'v1' was not declared in this scope
   54 |                     for(int j : v1[z])
      |                                 ^~
joitter2.cpp:55:39: error: 'us' was not declared in this scope
   55 |                         if(j != y && !us[j][y])
      |                                       ^~
joitter2.cpp:60:29: error: 'v' was not declared in this scope
   60 |                             v[j].push_back(y) ;
      |                             ^