Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:find out error

Posted by 110510274 at 2021-03-28 00:00:53 on Problem 1007
In Reply To:find out error Posted by:_shahariar_ at 2021-02-22 13:39:41
> Whats wrong with my code?
> Why I get compilation error? just for using <bits/stdc++.h> ?
> I use <iostream> header but till it gets compilation log.
> 
> 
> 
> /* GOD CREATES ME TO THINK */
> 
> #include<bits/stdc++.h>
> using namespace std;
> #define ll long long
> #define ld long double
> #define sfi(x) scanf("%d",&x)
> #define sfl(x) scanf("%lld",&x)
> #define PB push_back
> #define MP make_pair
> #define FF first
> #define SS second
> #define ALL(x)  x.begin(), x.end()
> #define PI 3.141592653589793238462
> #define MM 10e9 + 7
> #define LP(i,a,b) for(ll i=(a);i<(b);i++)
> #define RLP(i,a,b) for(int i=(b);i>=a;i--)
> #define D(x) cout<<"DEBUG:\t"<<#x<<" = "<<x<<endl;
> bool cmp(pair<string, int>& a,
>          pair<string, int>& b)
> {
>     return a.second < b.second;
> }
> int main( )
> {
>     int n,t;
>     cin>>n>>t;
>     vector<pair<string,int>>v;
>     while(t--)
>     {
>         string s;
>         cin>>s;
>         int inv=0;
>         int len=s.size();
>         for(int i=0; i<len; i++)
>         {
>             for(int j=i; j<len; j++)
>             {
>                 if(s[i]>s[j])++inv;
>             }
>         }
>         //cout<<inv<<endl;
>         v.PB(MP(s,inv));
> 
>     }
>     sort(v.begin(),v.end(),cmp);
>     for (auto& it : v) {
>         cout << it.first << endl;
>     }
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator