Submission #1002840

# Submission time Handle Problem Language Result Execution time Memory
1002840 2024-06-19T20:27:59 Z hyakup MalnaRISC (COI21_malnarisc) C++17
0 / 100
1 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define bug(x) cout << #x << " " << x << endl;
#define pii pair<int, int> 


const int inf = 1e9 + 10; 
const int maxn = 100; 

queue<pii> fila[maxn]; 
vector<int> marc( maxn ); 

int main(){
    int n; cin >> n; 
    for( int i = 1; i < n; i++ ){
        for( int j = 1; j <= n - i; j++ ){
            fila[i].push({j, j + 1}); 
        }
    }
    
    bool ok = true; 
    queue<vector<pii>> resp; 
    while( ok ) {
        for( int i = 1; i <= n ;i++ ) marc[i] = 0; 
        ok = false ;
        vector<pii> v; 
        for( int i = 1; i < n; i++ ){
            if( !fila[i].empty() && !marc[fila[i].front().first] && !marc[fila[i].front().second] ){
                marc[fila[i].front().first] = 1;
                marc[fila[i].front().second] = 1;
                v.push_back(fila[i].front()); 
                fila[i].pop(); 
                if( !fila[i].empty() ) ok = true; 
            }
        }
        resp.push(v); 
    }

    cout << resp.size() << endl; 
    while( !resp.empty() ){
        for( auto[ a, b ] : resp.front() ) cout << "CMPSWP R" << a << " R" << b << " "; cout << endl; 
        resp.pop(); 
    }
    
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:42:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   42 |         for( auto[ a, b ] : resp.front() ) cout << "CMPSWP R" << a << " R" << b << " "; cout << endl;
      |         ^~~
malnarisc.cpp:42:89: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   42 |         for( auto[ a, b ] : resp.front() ) cout << "CMPSWP R" << a << " R" << b << " "; cout << endl;
      |                                                                                         ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 604 KB not sorted
2 Halted 0 ms 0 KB -