Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
139982 梁乃元 派对灯 C++ Compile Error 0 0 MS 0 KB 1327 2024-03-27 14:04:06

Tests(0/0):


# include <bits/stdc++.h> using namespace std ; int flag [7] , n , c , flg , k , state[9] [7] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 1 , 1 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 1 , 1 , 2 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 1 , 0 , 1 , 0 , 1 , 0 , 2 , 1 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , } ; int loc ( int x ) { return ( x % 6 == 0 ? 6 : x % 6 ) ; } int chk ( int s) { if ( state [s] [0] > c ) { return 0 ; } if ( c == 2 && s == 4 ) { return 0; } if ( c == 3 && ( s == 2 || s == 5 || s == 7 ) ) { return 0; } if ( c == 1 && s == 8 ) { return 0 ; } for ( int i = 1 ; i <= 6 ; i ++ ) { if ( ! flag [i] - 1 ) { continue ; } if ( state [s] [i] != flag [i] ) { return 0; } } return 1; } int main ( ) { memset ( flag , -1 , sizeof ( flag ) ) ; cin >> n >> c ; for ( int k ; cin >> k && k != -1 ; flag [Loc ( k )] = 1 ) ; for ( int k ; cin >> k && k != -1 ; flag [Loc ( k )] = 0 ) ; for ( int i = 1 ; i <= 8 ; i ++ ) { if ( chk ( i ) ) { for ( int j = 1 ; j <= n ; j ++ ) { cout << state [i] [loc ( j )] ; } cout << endl ; flg = 1 ; } } if ( ! flg ) { cout << "IMPOSSIBLE" << endl ; } return 0 ; }


Judgement Protocol: