| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
find out errorWhats 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator