提出 #66813822


ソースコード 拡げる

#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define mk make_pair
#define ll long long
#define ull unsigned long long
#define uint unsigned int
#define bi __int128_t
#define lb(x) ((x)&(-(x)))
#define gp(i,j) (((i)>>(j-1))&1)
#define ppc __builtin_popcount
#define ctz __builtin_ctz
#define db long double
using namespace std;
const int N=515,mod=1e9+7,inf=1e9+10;
const db eps=1e-8;
bool Mbg;
void Add(int &a,int b){a+=b;if(a>=mod) a-=mod;}
void Sub(int &a,int b){a-=b;if(a<0) a+=mod;}
void Mul(int &a,int b){a=1ll*a*b%mod;}
int qp(int a,int b){
    int x=1;
    while(b){
        if(b&1) Mul(x,a);
        Mul(a,a);b>>=1;
    }return x;
}
int L[N],R[N],du[N],du2[N],pr[N],n;
bitset<N> to[N];
bool vis[N],avb[N];
vector<int> E[N],G[N];
bool cmp(vector<int> a,vector<int> b){
    for(int i=0;i<min(a.size(),b.size());i++){
        if(a[i]<b[i]) return 1;
        if(a[i]>b[i]) return 0;
    }return 0;
}//a neq b
void slv(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>L[i]>>R[i];
    for(int i=1;i<=n;i++) du[i]=0,E[i].clear(),G[i].clear();
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(L[i]<L[j]&&R[j]<R[i]){
                E[j].push_back(i);
                G[i].push_back(j);
                du[i]++;du2[j]++;
                //cout<<j<<' '<<i<<endl;
            }
        }
    }priority_queue<int> pq;
    for(int i=1;i<=n;i++) to[i].reset(),to[i].set(i,1);
    for(int i=1;i<=n;i++) if(!du2[i]) pq.push(i);
    int cnt=n;
    while(!pq.empty()){
        int u=pq.top();pq.pop();
        pr[u]=cnt--;
        for(auto v:G[u]){
            du2[v]--;to[v]|=to[u];
            if(!du2[v]) pq.push(v);
        }
    }
    for(int i=1;i<=n;i++) cout<<pr[i]<<' ';cout<<endl;
}
bool Med;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;cin>>t;
    while(t--) slv();
    cout.flush();
    cerr<<clock()*1.0/CLOCKS_PER_SEC<<' '<<(&Mbg-&Med)/1024.0/1024.0<<endl;
    return 0;
}

提出情報

提出日時
問題 C - Movie Theater
ユーザ LYLAKIOIAKIOI
言語 C++ 20 (gcc 12.2)
得点 700
コード長 2042 Byte
結果 AC
実行時間 3 ms
メモリ 5248 KiB

コンパイルエラー

Main.cpp: In function ‘bool cmp(std::vector<int>, std::vector<int>)’:
Main.cpp:34:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const long unsigned int’ [-Wsign-compare]
   34 |     for(int i=0;i<min(a.size(),b.size());i++){
      |                 ~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function ‘void slv()’:
Main.cpp:64:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   64 |     for(int i=1;i<=n;i++) cout<<pr[i]<<' ';cout<<endl;
      |     ^~~
Main.cpp:64:44: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   64 |     for(int i=1;i<=n;i++) cout<<pr[i]<<' ';cout<<endl;
      |                                            ^~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 700 / 700
結果
AC × 1
AC × 27
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 03_random_12.txt, 03_random_13.txt, 03_random_14.txt, 03_random_15.txt, 03_random_16.txt, 03_random_17.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3840 KiB
01_small_00.txt AC 1 ms 3840 KiB
01_small_01.txt AC 1 ms 3720 KiB
01_small_02.txt AC 1 ms 3792 KiB
02_handmade_00.txt AC 1 ms 3876 KiB
02_handmade_01.txt AC 1 ms 3908 KiB
02_handmade_02.txt AC 3 ms 5248 KiB
02_handmade_03.txt AC 3 ms 5080 KiB
02_handmade_04.txt AC 3 ms 5192 KiB
03_random_00.txt AC 1 ms 3856 KiB
03_random_01.txt AC 1 ms 3796 KiB
03_random_02.txt AC 1 ms 3856 KiB
03_random_03.txt AC 1 ms 3960 KiB
03_random_04.txt AC 1 ms 3912 KiB
03_random_05.txt AC 1 ms 3996 KiB
03_random_06.txt AC 1 ms 3792 KiB
03_random_07.txt AC 1 ms 3936 KiB
03_random_08.txt AC 2 ms 4312 KiB
03_random_09.txt AC 2 ms 4472 KiB
03_random_10.txt AC 3 ms 4468 KiB
03_random_11.txt AC 3 ms 4336 KiB
03_random_12.txt AC 3 ms 4444 KiB
03_random_13.txt AC 2 ms 4372 KiB
03_random_14.txt AC 2 ms 4428 KiB
03_random_15.txt AC 2 ms 4272 KiB
03_random_16.txt AC 3 ms 4400 KiB
03_random_17.txt AC 2 ms 4376 KiB