답안 #765016

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
765016 2023-06-24T07:33:45 Z 1075508020060209tc Sob (COCI19_sob) C++14
110 / 110
583 ms 19076 KB

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define X first
#define Y second
int n;int m;
int vis[1000006];

signed main(){
vector<pair<int,int>>ans;
cin>>n>>m;
int lst=0;
for(int i=n-1;i>=0;i--){
    if(lst!=0&&vis[lst-1]==0&&((i&(lst-1+m))==i)  ){
        lst--;
        ans.push_back({i,lst+m});
        vis[lst]=1;
        continue;
    }
    for(int j=0;j<=n-1;j++){
        if(vis[j]){continue;}
        if( ((i&(j+m))==i)  ){
            ans.push_back({i,j+m});
            lst=j;
            vis[j]=1;
            break;
        }
    }
}
for(int i=0;i<ans.size();i++){
    cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
}

Compilation message

sob.cpp: In function 'int main()':
sob.cpp:32:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 | for(int i=0;i<ans.size();i++){
      |             ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 288 ms 10140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 468 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 319 ms 10108 KB Output is correct
7 Correct 164 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 288 ms 10140 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 319 ms 10108 KB Output is correct
11 Correct 164 ms 4940 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 61 ms 2320 KB Output is correct
20 Correct 232 ms 7696 KB Output is correct
21 Correct 9 ms 692 KB Output is correct
22 Correct 4 ms 468 KB Output is correct
23 Correct 370 ms 10896 KB Output is correct
24 Correct 549 ms 19076 KB Output is correct
25 Correct 583 ms 18772 KB Output is correct