답안 #1026885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1026885 2024-07-18T12:59:05 Z MarwenElarbi 곤돌라 (IOI14_gondola) C++17
40 / 100
47 ms 6092 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
#define pb push_back
#define se second
#define fi first
const int nax=5e5+5;
const int MOD=1e9+9;
int valid(int n, int inputSeq[])
{
    vector<pair<int,int>> tab;
    bool test=true;
    set<int> stt;
    for (int i = 0; i < n; ++i)
    {
        stt.insert(inputSeq[i]);
    }
    test&=(stt.size()==n);
    int cnt=-1e9;
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]<=n){
            cnt=(inputSeq[i]-(i+1)+n)%n;
        }
    }
    if(cnt==-1e9) return test;
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]<=n){
            if((inputSeq[i]-(i+1)+n)%n!=cnt) test=false;
        }
    }
    return test;
}
 
//----------------------
 
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
   for (int i = 0; i < n; ++i)
   {
       if(gondolaSeq[i]<=n){

       }
   }
}
 
//----------------------
 
int countReplacement(int n, int inputSeq[])
{
    long long cur=1;
    set<int> st;
    if(!valid(n,inputSeq)) return 0;
    for (int i = 0; i < n; ++i)
    {
        st.insert(i);
    }
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]<=n) st.erase(inputSeq[i]);
    }
    if(st.size()==0) return 1;
    set<int> stt;
    for (int i = 0; i < n; ++i)
    {
        if(inputSeq[i]>n) stt.insert(inputSeq[i]);
    }
    int cnt=n;
    while(stt.size()){
        //cout <<cnt<<endl;
        for (int i = cnt; i < *stt.begin()-1; ++i)
        {
            cur=(cur*1ll*(int)stt.size())%MOD;
        }
        cnt=*stt.begin();
        stt.erase(*stt.begin());
    }
    return cur;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:22: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     test&=(stt.size()==n);
      |            ~~~~~~~~~~^~~
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
   46 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 508 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 7 ms 2360 KB Output is correct
7 Correct 20 ms 3704 KB Output is correct
8 Correct 14 ms 3932 KB Output is correct
9 Correct 7 ms 1496 KB Output is correct
10 Correct 21 ms 4628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 7 ms 2140 KB Output is correct
7 Correct 26 ms 3676 KB Output is correct
8 Correct 14 ms 3928 KB Output is correct
9 Correct 5 ms 1372 KB Output is correct
10 Correct 17 ms 4640 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 11 ms 2068 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 26 ms 4824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 47 ms 5996 KB Output is correct
10 Correct 38 ms 4572 KB Output is correct
11 Correct 16 ms 2396 KB Output is correct
12 Correct 16 ms 2908 KB Output is correct
13 Incorrect 4 ms 860 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 46 ms 6092 KB Output is correct
10 Correct 35 ms 4700 KB Output is correct
11 Correct 13 ms 2396 KB Output is correct
12 Correct 20 ms 2876 KB Output is correct
13 Incorrect 4 ms 860 KB Output isn't correct
14 Halted 0 ms 0 KB -