Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
14101 1280 5
14101 1280 5
14103 1280 1
14103 1280 1
14105 1280 13
14106 1279 7
14107 1278 6
14108 1278 3
14109 1277 3

x,n,m = map(int,input().split())
t = 0
for i in range(n+1):
t += x**n
print(t % m)

14110 1277 6
14111 1277 2
14112 1277 2
14112 1277 2
14114 1277 4
14115 1276 2
14116 1275 4
14117 1275 1
14118
TuanLovesCPP
Nguyễn Thanh Tuấn
1275 12

Tôi Là Người Mới Học Lập Trình

14119
Minhmon0107
Trần Ngọc Minh
1275 9
14120 1275 4
14121
KINGYEAH
BÙI GIA BẢO - TH2
1274 21
14122 1273 3
14123 1273 1

include<iostream>

include <ext/pb_ds/assoc_container.hpp>

include <ext/pb_ds/tree_policy.hpp>

include<math.h>

include<algorithm>

include<stdio.h>

include<map>

include<vector>

include<set>

include<iomanip>

define F first

define S second

define P system("PAUSE");

define H return 0;

define pb push_back

define mod 1000000007

using namespace std;
using namespace __gnu_pbds;
bool sc(pair<int ,int> a, pair<int,int> b)
{
if(a.F==b.F)
return b.S<a.S; else return a.F\<b.F; } typedef tree\<int,null_type,less\<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin>>n;
map<pair\<int,int>,pair\<int, int>> res;
vector<pair\<int,int>> a(n),b;
for(int i=0;i<n;i++) cin>>a[i].F>>a[i].S;
b=a;
sort(a.begin(),a.end(),greater());

set<int> luu;
luu.insert(a[0].S);
int minn,maxx;
minn=a[0].S;
for(int i=1;i<n;i++)
{
    if(a[i].S>=minn)
    res[a[i]].F=1;
    else minn=a[i].S;

}
 for(int i=0;i<n;i++)
cout<<a[i].F<<' '<<a[i].S<<endl; 
sort(a.begin(),a.end(),sc);
maxx=a[0].S;
luu.clear();
luu.insert(a[0].F);

for(int i=1;i<n;i++)
{
    if(a[i].S<=maxx)
    res[a[i]].S=1;
    else maxx=a[i].S;
}
 for(int i=0;i<n-1;i++)
 cout<<res[b[i]].F<<' ';
   cout<<res[b[n-1]].F;
 cout<<endl;
 for(int i=0;i<n-1;i++)
 cout<<res[b[i]].S<<' ';
 cout<<res[b[n-1]].S;

}

14124 1273 3
14125 1272 8
14126 1270 3
14127 1270 4
14127 1270 4
14127 1268 3
14130 1268 18
14131 1267 2
14132 1267 3
14133 1267 8
14134 1266 10
14135 1266 5
14136 1266 6
14137 1265 7
14137
29211458148
Lê Đức Anh
1265 7
14139 1265 4
14140 1264 6
14141 1264 4
14142
tranngocthu1612
Trần Thị Ngọc Thư
1263 20
14143 1263 3
14144 1262 19
14144 1262 19
14144
thanhtruc08
nguyen vi thanh truc 10 hoa
1262 19
14144
thaile422008
LÊ ĐÌNH THÁI LỚP VĂN
1262 19
14144
nhk28092008
Nguyễn Hoàng Kim 10 Anh
1262 19

Nguyễn Hoàng Kim
10 Anh

14144 1262 19
14144 1262 19
14151 1262 8
14152 1261 2

None

14153 1260 7
14154 1260 7
14155 1260 4
14156 1260 1
14156 1260 1
14156 1260 1

tao là thằng liều

14156 1260 1
14160 1260 3
14161 1259 9
14162 1259 7
14163 1258 18
14164 1258 7
14165 1257 12
14166
STRB13Tu
Trần Anh Tú
1257 6
14167 1257 5
14167 1257 5
14169 1255 9
14170 1255 3
14171 1254 5
14172
linhqt1003
Trần Tùng Linh
1254 19
14173 1253 6
14174
BL7D23_SONTT
Thái Thanh sơn
1253 19
14175 1252 5
14175 1252 5
14175 1252 5
14178 1252 5
14179 1250 7
14180 1250 4
14181 1249 5
14182
thanhminh2009
Phan Thanh Minh
1249 6
14183 1249 6
14184 1249 6
14185 1247 12
14186 1246 8
14187 1245 6
14188 1244 10
14189 1242 19
14190 1242 4
14191 1241 18
14192 1241 19
14193 1241 4
14194 1239 2
14195 1239 7
14196
hailybesy
Chử Khánh Phong
1238 20
14197 1238 9
14198 1237 4
14199
BL8C23_MinhAnhNT
Nguyễn Thị Minh Ánh
1237 14
14200 1237 2