답안 #595872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
595872 2022-07-14T07:48:58 Z AGE Sob (COCI19_sob) C++14
29 / 110
386 ms 8336 KB
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long

using namespace std;
const int N=2e6+10,M=2e3,mod=10;

bool vis[N];
main()
{

    int n,m;
    cin>>n>>m;
    vector<pair<int,int>>v;
    
    for(int i=m;i<n+m;i++){

        bitset<32>bt;
        int num=0;
        bt=i;

        for(int j=0;j<31;j++){
            if(bt[j]==1){
                num+=(1<<j);

                if(vis[num]==0){
                    vis[num]=1;
                    break;
                }
            }
        }


        if(num==n){
            num=0;
        }

        v.pb({num,i});

    }

    sort(v.begin(),v.end());

    for(int i=0;i<v.size();i++)
        cout<<v[i].F<<" "<<v[i].S<<endl;

    return 0;

}

Compilation message

sob.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
sob.cpp: In function 'int main()':
sob.cpp:46:18: 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]
   46 |     for(int i=0;i<v.size();i++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=x] equals to 512, violates the range [0, 127]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 340 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 386 ms 8336 KB Output is correct
7 Correct 191 ms 4084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=x] equals to 13, violates the range [0, 11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer parameter [name=x] equals to 512, violates the range [0, 127]
2 Halted 0 ms 0 KB -