09
A
Wrong Answer
C
1 min ago
cleanX
C
Accepted
1	0.3	
C++
3 min ago
AKS03
C
Wrong Answer
C
3 min ago
Anurag_Khot
C
Accepted
1	0.3	
C++
4 min ago
DudeL69
B
Accepted
1	0.3	
C++
5 min ago
wsxcvghj
A
Wrong Answer
C++
6 min ago
GraciousSaxena
D
Accepted
43	3.2	
C++
7 min ago
unburntash
C
Wrong Answer
Python
8 min ago
wsxcvghj
A
Wrong Answer
C++
9 min ago
ishavp_cs19
C
Wrong Answer
Python
9 min ago
Anurag_Khot
B
Wrong Answer
C++
11 min ago
Mr_Infinity
B
Wrong Answer
C++
11 min ago
sriharic
B
Accepted
1	0.3	
C++
12 min ago
cleanX
B
Wrong Answer
Python
13 min ago
DudeL69
E
Wrong Answer
C++
13 min ago
trax_2703
D
Accepted
122	1.8	
C++
13 min ago
unburntash
C
Wrong Answer
Python
14 min ago
GraciousSaxena
D
Time Limit Exceeded
C++
14 min ago
Marchingspy
B
Accepted
1	0.3	
C++
15 min ago
     
All Copyright Reserved © 2010-2020 Xu Han
Server Time: 2020-04-11 23:18:35 UTC+5.5

#25260931 | Mr_Infinity's solution for [Problem B]
Status
Wrong Answer
Length
1353
Lang
C++14 (GCC 5.3.0)
Submitted
2020-04-11 23:06:45
Shared

12.0 / 18.0
Select Code
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n,i;
    cin>>n;
    int m;cin>>m;
    vchar a(n);
    int pos,val;
    for(i=0;i<a.size();i++) a[i]='b';
    bool f1=0,f2=0;
    while(m--){
        cin>>pos>>val;
        if(val==0 && pos==1) f1=1;
        char c=val+'0';
        if(a[n-pos]=='b') {
            a[n-pos]=c;
        }
        else if(a[n-pos]!=c){f2=1;break;}
        else {
            a[n-pos]=c;
        }
    }
    reverse(a.begin(), a.end()); 
    for(i=0;i<n;i++){
        if(a[i]=='b') a[i]='0';
    }
    int in=0;
    while(a[i]=='0'){
        in++;
        i++;
    }
    //cout<<f1<<f2;
  if(!f2 && (f1==0 && n!=1)){
    for(i=in;i<n;i++){
        
        cout<<a[i];
    }}
    else cout<<-1;
    return 0;
}
